object Main extends App {
  val src: List[Int] = io.Source.stdin.getLines.map(_.toInt).toList

  val maxVal: Int = src.max

  val countedList: List[Int] = (for (i <- 1 to maxVal) yield (src.count(_ == i))).toList

  val maxModes = countedList.max

  def countLiWithIndex(li: List[Int]): List[(Int, Int)] = li.zipWithIndex

  def pickModes(li: List[(Int, Int)]): List[Int] = {
    for { tup <- li
        if (tup._1 == maxModes)
    } yield {
      tup._2 + 1
    }
  }

  pickModes(countLiWithIndex(countedList)).foreach(println)
}