Very much so. it's taken in as part of the equation to come up with the MD5 hash, so if you don't match the number, then you'll run into problems!
One of the cool things with MD5 keys in OSPF is that you can have multiple keys on the same interface for different peers.
Hub/spoke is a nice way to see this....
Hub can have key 1 = cisco and key 2 = ccie
spoke 1 has key 1 = cisco
spoke 2 has key 2 = ccie (even though this is the ONLY key defined, it must be #2)
Try it! Play!
Run your debugs, let the router tell you what it likes and doesn't like!
Just a note: OSPF keys has nothing do to with key chains, so lots of troubles saved, yeay! Also, when N keys are in use, N duplicates of a single packets will be send.
To Scott: I think I might had a time using different OSPF key numbers and actually worked, I'm not absolutely sure so I will rerun the lab to confirm.