import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) if len(types) > 1: a = {} for value in types: if value not in a: a[value] = 1 else: a[value] += 1 if len(a) == 1: print [value] print max(a, key=a.get) else: print 1