object Solution { def main(args: Array[String]) { val sc = new java.util.Scanner (System.in); var n = sc.nextInt(); var types = new Array[Int](n); val freq = scala.collection.mutable.HashMap[Int,Int](1 -> 0, 2 -> 0, 3 -> 0, 4 -> 0, 5 -> 0) for(types_i <- 0 to n-1) { // Increment the frequency of the bird instead of storing the bird's type freq(sc.nextInt()) += 1; } val m = freq.maxBy(_._2)._2 // Print the type of the bird which has the most occurence print(freq.filter(_._2 == m).keys.min) } }