eolymp
bolt
Try our new interface for solving problems

Coins

There are n coins on the table. Some of them have heads up, and some of them have tails up. Find the minimum number of coins to reverse, so that all coins will be turned up with the same side.

prb2218

Input

The first line contains number of coins n (1n100). Each of the next n lines contains one integer: 1 if the coin is tails up or 0 if heads up.

Output

Print the minimum number of coins to reverse.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
1
0
1
1
0
Output example #1
2
Source 2006, XIV St. Petersburg School Programming Team Championship, November 6, Problem B