Majority Votes

0

0 votes
Basic Programming, Basics of Input/Output
Problem

Malana is a small town located in Himachal Pradesh. The people of Malana had decided to change their leader, they conducted elections in the town. The person who gets the majority votes will win the election and will be served as the leader of Malana. The problem is that the people had voted to their trusted leader, there is a problem with the counting machine. As you are one of the citizens of Malana had tried to create a machine that counts all the votes. There are a number of different parties who are contesting in the elections each party is represented with its party number.

Input

The first line contains the total number of votes polled n.                                                                                                                              The next line contains n number of votes representing the party number.

Output

Print the majority party number. if the majority of votes is the same for one or more parties then print the party number which comes first.

Constraints

1 < = n <= 105

1 <= arr[i] <= 108

 

  

Time Limit: 0.2
Memory Limit: 256
Source Limit:
Explanation

Party number 3,4,5 has the maximum votes and having the same number of votes as three occurs first. So party three wins the election.

Editor Image

?