Flipping Coins
InterviewTime limit1sMemory limit128 MB
Count the heads and tails and flip the coins on the less frequent side so all coins show the same face.
Problem
Bajtek has coins. Each coin has two sides, heads and tails, and all of them are currently lying on a table. Bajtek wants every coin to show heads, or every coin to show tails. Find the minimum number of coins he has to flip to the other side to achieve this.
Input
The first line contains one integer (), the number of coins.
The second line contains integers separated by spaces. Here describes the -th coin: it is if the coin shows heads and if it shows tails.
Output
Print a single integer: the minimum number of coins Bajtek has to flip so that all coins show the same side.