import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); HashMap map=new HashMap<>(); for(int n=0;n> list=new ArrayList(map.entrySet()); list.sort(new Comparator>() { @Override public int compare(HashMap.Entry o1, HashMap.Entry o2) { if(!o1.getValue().equals(o2.getValue())) { return -Integer.compare(o1.getValue(), o2.getValue()); }else { return o1.getKey().compareTo(o2.getKey()); } } }); for(int i=0;i Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }