#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here d = dict() for t in types: if t not in d: d[t] = 1 else: d[t] += 1 m = 1 for k, v in d.iteritems(): if d[m] < v: m = k print m