#!/bin/python import sys birds = {1:0,2:0,3:0,4:0,5:0} n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here if n == 0: print 1 exit(1) for x in types: birds[x] += 1 max = [0,0] for bird in birds: if birds[bird] > max[1]: max[0] = bird max[1] = birds[bird] elif (birds[bird] == max[1] and bird < max[0]): max[0] = bird print max[0]