#C8558. Majority Element

    ID: 52553 Type: Default 1000ms 256MiB

Majority Element

Majority Element

Given a list of integers, your task is to find the majority element. The majority element is the element that appears more than (\lfloor n/2 \rfloor) times in the list, where (n) is the number of elements. It is guaranteed that the majority element always exists.

For example, if the input array is [3, 2, 3], the majority element is 3.

inputFormat

The first line of input contains an integer (n) denoting the number of elements in the list. The second line contains (n) space-separated integers.

outputFormat

Output a single integer representing the majority element.## sample

3
3 2 3
3