take the number of flips as an argument