How many flip-flops do I need based on the following requirement? I'm thinking 2 flip-flop since each flip-flop can be a 0 or 1. So each flip-flop holds 2 states. Design a clocked synchronous state machine with two inputs, X and Y, and one output, Z. The output should be 1 if the number of 1 inputs on X and Y since reset is a multiple of 4, and 0 otherwise. At first glance, you might think the machine needs an infinite number of states, since it counts 1 inputs over an arbitrarily long time. However, since the output indicates the number of inputs received modulo 4, four states are sufficient.