// No.79 過小評価ダメ・ゼッタイ package main import ( "bufio" "fmt" "os" "slices" "strconv" ) func main() { var sc = bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) nextInt := func() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } n := nextInt() m := map[int]int{} for i := 0; i < n; i++ { m[nextInt()]++ } getKeys := func(m map[int]int) []int { keys := []int{} for k := range m { keys = append(keys, k) } return keys } l := getKeys(m) slices.Sort(l) most, ans := 0, 0 for j := 0; j < len(l); j++ { most = max(most, m[l[j]]) if most == m[l[j]] { ans = l[j] } } fmt.Println(ans) }