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); Dictionary birds = new Dictionary(); birds.Add(1,0); birds.Add(2,0); birds.Add(3,0); birds.Add(4,0); birds.Add(5,0); foreach (int t in types) { birds[t]++; } int type = 0; var sorted = birds.OrderByDescending(bird => bird.Value).ToArray(); type = sorted[0].Key; for (int i = 1; i < sorted.Length;i++) { if (sorted[i].Value == sorted[i-1].Value) { if (sorted[i].Key < sorted[i-1].Key) { type = sorted[i].Key; } } else {break;} } Console.WriteLine(type); } }