#!/bin/python3 import sys def contains(dictionary, string): for key in dictionary: if key == string: return True; return False dict = {} num = int(input()) array = input().split(" ") for i in range(0, len(array)): if contains(dict, array[i]) == True: dict[array[i]] += 1 elif contains(dict, array[i]) == False: dict.update({array[i]: 1}) most = 0 birds = [] for key, value in dict.items(): if value >= most: most = value del birds[:] birds.append(key) lowest = int(birds[0]) if len(birds) > 1: for i in range(0, len(birds)): if int(birds[i]) < lowest: lowest = int(birds[i]) print(lowest)