#include #include #include #include int cmp(const void *a,const void *b){ if(*(int*)a>*(int*)b){return 1;} else if(*(int*)a<*(int*)b){return -1;} else {return 0;} } int l[100005]; int main(void){ int now=0,max=0,level=0; int n; scanf("%d",&n); for(int i=0;i=max){max=now; if(l[i-1]>=level){ level=l[i-1]; } break; } } if(l[i]==l[i-1]){now++;} else { if(now>=max){max=now; if(l[i-1]>=level){ level=l[i-1]; } } now=0; } } printf("%d\n",level); }