Count the number of flips