import java.util.Scanner;

public class MigratoryBirds {

	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);
		int a[] = new int[6];
		int t = scan.nextInt();
		while (t-- > 0) {
			a[scan.nextInt()]++;
		}
		int index  = 0 ;
		int max = 0;
		for(int i = 0 ; i < a.length ; i++) {
			if(a[i] > max) {
				max = a[i];
				index = i;
			}
		}
		System.out.println(index);
	}
}