All you need to know is whether the number of as is even or odd and whether the number of bs is even or odd. That's two parameters, each of which can take one of two values. That's two bits of information, and four states.