e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Data Structures contest

Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times.

Input

First line contains number n (1n100). Second line contains n positive integers.

Output

If the array contains majority element, then print it. Otherwise print -1.

Time limit 1 second
Memory limit 128 MiB
Input example #1
7
3 3 5 4 2 3 3
Output example #1
3
Input example #2
4
2 3 2 3
Output example #2
-1