#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here dict_types = {} for i in types: if i in dict_types: dict_types[i] +=1 else: dict_types[i] = 1 maxtype = 5 maxcount = 0 x = list(set(dict_types)) x.reverse() for i in x: if dict_types[i] >= maxcount: maxcount = dict_types[i] maxtype = i print maxtype