Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
I use a similar system, just adding a TOTAL entry to the end of every enum declaration. And unless I'm mistaken, the number of elements in your example is just player_states.NUM, which is 4.
I also use the method @RefresherTowel mentioned, I'd just like to state that for readability you might want to define that last element as something like length rather the uppercase version so you can visually distinguish it from the regular enum constants, or the reverse if your enum constants are lowercase
Just want to mention adding a "count" entry at the end only makes sense if you let the enums have 0 through n-1 values and you're not using the ability to assign arbitrary values to the enum entries, like 1,2,4,8,16 (not uncommon for bit flags, etc.) In such a scenario you will need to keep track of if some other way independent of the enum.