import java.util.Scanner; public class Main { public static void main(String[] args) { char[] a = new char[100000]; Scanner sc = new Scanner(System.in); int i, n, m, x = 0, t = 0; n = sc.nextInt(); for (i = 0; i < n; i++) { m = sc.nextInt(); a[m]++; } for (i = 0; i < 100000; i++) { if (a[i] > t) { t = a[i]; x = i; } } System.out.println(x); System.out.println(t); } }