Sonya has been tasked with organizing a relay race for first graders. The students will be divided into two teams: one for boys and one for girls. Importantly, each team must have the same number of participants. The key objective is to determine the event's success level.
The success level is defined as the maximum number of participants that can be included in one of the teams.
Sonya wants to quickly determine the success level so she can move on to solving programming problems, and she needs your assistance.
The first line contains a single integer (1\leq n\leq 100) —the number of first graders.
The second line contains integers a_1, a_2, \dots, a_n (1\leq a_i\leq 2) —where indicates the -th student is a boy, and indicates a girl.
Output a single number representing the maximum success level.
Example 1
Example 2
In the first example, you can select the first, fifth, and sixth boys for the boys' team, and the second, fourth, and seventh girls for the girls' team. The third student can replace any of them.
In the second example, the first and third students can be on the boys' team, although any of the other four boys could replace them, and the fifth and sixth students can be on the girls' team.