456. Minimum Cost to Move Chips
EasyParity
Chips sit at given positions. Moving a chip by 2 costs 0 and by 1 costs 1. Print the minimum cost to gather all chips at one position.
Input format
Line 1: n Line 2: n positions
Output format
The minimum cost.
Example 1
Input
3 1 2 3
Output
1
Example 2
Input
5 2 2 2 3 3
Output
2
Constraints
1 ≤ n ≤ 100
Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.
Loading the MyLoginn IDE…