The states are 0-2-1-4.
so if we take 2 flipflops states produced are 0,1,2,3
hence 4 is not there .to represent the fourth state we need 3 bits.
Hence 3 flip flops are enough to represent the states 0,1,2,3,4,5,6,7
out of which our counter is 0-2-1-4.