import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int n=Integer.parseInt(bu.readLine()); int i; long a; String s[]=bu.readLine().split(" "); TreeMap tm=new TreeMap<>(); for(i=0;i tm,long x) { int v=tm.get(x); if(v==1) tm.remove(x); else tm.put(x,v-1); } }