int getMain(int* a, int length){ int count =0; int seed = a[0]; for(int i=0; i<length; i++){ if(a[i]==seed) count++; else if(count>0) count--; else seed = a[i]; } return seed; }