#!/bin/python import sys import collections as counter n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here c = counter.Counter(types) print max(c,key=c.get)