It's that time in Tssojistan, time to elect a new HacKing! (yes, kings are elected here, don't ask questions) The "democratic" voting takes place by dividing all the citizens into groups based on their programming language, and having each group vote at different times throughout the election day (as groups like C++ and Java are known to not get along).
Moreover, strictly half of the groups will vote at Benum's Booth while the other half will vote at Naccarato's Nook. This is to lower waiting and queue times at each booth, as programmers are very stingy about being efficient. After votes from station have been counted, if a certain candidate wins a strict majority of individual votes from both stations, they will be crowned the new HacKing. Otherwise, the current HacKing will remain on the throne.
is the only candidate running this year against the curent HacKing, . However he is quite concerned about his campaign. He fears he hasn't garnered enough support to overthrow , as his blinding scalp seems to scare away a significant part of the population. And so, being the sneaky sasquatch he is, he comes to you for help with his plan to sabotage the election.
With the help of
and his family of computer scammers, has managed to collect the voter info for every voting group in Tssojistan, and knows for certain who they will vote for on election day. He plans to rig the election by reassigning the groups and their designated voting booths to give himself a favourable advantage, while still making sure each booth has strictly half of the groups. He needs you to calculate how many unique pairs of votes from both booths that he can become the HacKing with, by reassigning the groups.Input Specification
The first line of the input will contain an integer , representing the number of voters per group.
The second line of the input will contain an even integer , representing the number of total groups.
The third line will contain integers denoting the amount of citizens who voted for in group .
Constraints
Output Specification
The number of unique pairs of votes from the 2 booths that will allow oh boo hoo
.
Sample Input 1
5
4
2 3 3 4
Sample Output 1
1
Explanation
and supporters to one booth, and the groups with supporters to the other, as both booths will have a majority with of voters for .
can only win a strict majority at both booths if he sends the group withSample Input 2
5
8
2 4 2 3 3 3 3 3
Sample Output 2
1
Explanation
A solution is to send the first groups to one booth and the last to the other for a majority of in one booth and in the other. All other solutions will also have votes from a booth and in the other, so they are not unique from this one.
Sample Input 3
8
10
3 5 5 5 2 8 6 6 3 4
Sample Output 3
3
Explanation
The 3 unique pairs are and .
Sample Input 4
11
15
2 2 3 4 4 6 7 3 10 9 10 4 5 3 9
Sample Output 4
oh boo hoo
Explanation
oh boo hoo
Comments