You have four balls, each with a color represented by a number. Your goal is to find out how many pairs of balls you can remove if you can only remove two balls of the same color at a time.
Input: [2, 1, 2, 1]
Output: 2
Input: [4, 4, 4, 1]
Output: 1