#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here counts = [0]*6 for t in types: counts[t] += 1 a = [(i,c) for (i,c) in enumerate(counts) if i] a.sort( key = lambda (i,c): (-c,i)) print a[0][0]