Because this is a binary problem you can use binary arithmetic and counting. 0 can be used to represent even and 1 odd. The numbers 0-15 converted to binary match exactly what you present as E and O:
0000 0001 0010 0011 0100 0101 0110 0111
( 0 1 2 3 4 5 6 7 )
1000 1001 1010 1011 1100 1101 1110 1111
( 8 9 10 11 12 13 14 15 )
This is, of course, the original principle of computer logic, because a binary state is Yes/No, On/Off, Even/Odd, Positive/Negative, etc. That is, any two state system.