C. Elections
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest amount of money you need to spend on bribing to win the elections. To win elections you need to have strictly more votes than any other candidate.
Input
First line contains one integer n (1 ≤ n ≤ 105) — number of voters in the city. Each of the next