using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int WD=300; int[] B=new int[N]; int[] BP=new int[N/300+1]; Dictionary> D=new Dictionary>(); for(int i=0;i()); D[A[i]].Add(i); } var Keys=new List(D.Keys); Keys.Sort(); for(int t=0;t L=new List(); foreach(var j in D[k]){ //if(B[j]==0 && BP[j/WD]==0){ L.Add(j); //} } if(L.Count==0)continue; int left=L.Min(); int right=L.Max(); for(int i=left;i<=right;i++){ if(i%WD==0 && i+WD<=right){ BP[i/WD]=k; i+=WD-1; continue; } B[i]=k; } } /*for(int i=0;iint.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }