

Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
4 個のボールがあり、i 個目のボールの色は A_i です。
同じ色のボールを 2 つ選び両方捨てるという操作を最大何回行えるか求めてください。
制約
- A_1,A_2,A_3,A_4 はそれぞれ 1 以上 4 以下の整数
入力
入力は以下の形式で標準入力から与えられる。
A_1 A_2 A_3 A_4
出力
操作回数の最大値を整数として出力せよ。
入力例 1
2 1 2 1
出力例 1
2
1 個目のボールと 3 個目のボールはどちらも色が 2 なので、1 個目のボールと 3 個目のボールを共に捨てる操作を行えます。
次に、2 個目のボールと 4 個目のボールはどちらも色が 1 なので、2 個目のボールと 4 個目のボールを共に捨てる操作を行えます。
合計で 2 回操作を行えます。
入力例 2
4 4 4 1
出力例 2
1
入力例 3
1 2 3 4
出力例 3
0
操作を一度も行えない場合もあります。
Score : 100 points
Problem Statement
There are four balls, and the color of the i-th ball is A_i.
Find the maximum number of times you can perform this operation: choose two balls of the same color and discard both.
Constraints
- Each of A_1, A_2, A_3, A_4 is an integer between 1 and 4, inclusive.
Input
The input is given from Standard Input in the following format:
A_1 A_2 A_3 A_4
Output
Print the maximum number of times the operation can be performed as an integer.
Sample Input 1
2 1 2 1
Sample Output 1
2
The first and third balls both have color 2, so you can perform the operation to discard the first and third balls together.
Next, the second and fourth balls both have color 1, so you can perform the operation to discard the second and fourth balls together.
Hence, you can perform a total of two operations.
Sample Input 2
4 4 4 1
Sample Output 2
1
Sample Input 3
1 2 3 4
Sample Output 3
0
There are cases where you cannot perform the operation even once.