LearnPy Hub
← Arena
IntermediateRating 1100

Majority Element

Print the value that appears more than n/2 times, or -1 if none does.

Input

n, then n integers.

Output

A value or -1.

Sample 1

Input
7
2 2 1 1 1 2 2
Output
2

Sample 2

Input
3
1 2 3
Output
-1
solution.py
Output appears here
Majority Element · Python Arena problem · LearnPy Hub