using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] types_temp = Console.ReadLine().Split(' '); int[] types = Array.ConvertAll(types_temp,Int32.Parse); var i = ((types.GroupBy(k => k)).OrderByDescending(k=>k.Count())).First(); int key = i.Key; int maxCnt = types.Count(k => k == key); for (int j = 1; j <= 5; j++) { if (j == key) { continue; } int cnt = types.Count(k => k == j); if (cnt == maxCnt) { key = Math.Min(j, key); } } Console.Write(key); } }