#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) count = {} for bird_type in types: try: count[bird_type] += 1 except: count[bird_type] = 1 common_type = 0 count_max = 0 for key, value in count.iteritems(): if value > count_max: count_max = value common_type = key print common_type