I found this out the hard way.
If you use iTunes Match (and I do because I am an artist and I like to think that this way other artists get paid fairly),
BEFORE you upgrade your OS; DEACTIVATE said device in your iTunes account. If you don't, the new OS will count as a new device using up one of your five permitted. If, like me, you upgrade 2 PC's and use an iPad or phone there are your five used right there. The only way to undo this is to 'Deactivate All' (which you can only do once a year)

I thought this might be helpful.