#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here type_freq = {} for t in types: if t in type_freq: type_freq[t] += 1 else: type_freq[t] = 1 max_type = 0 max_freq = 0 for k,v in type_freq.items(): if type_freq[k] > max_freq: max_freq = v max_type = k print(max_type)