#pragma comment(linker, "/STACK:102400000,102400000") #include #include #include #include #include #include #include #include #include #include #include #include #include #define PI (acos(-1.0)) #define lowbit(x) (x&(-x)) typedef long long LL; using namespace std; const int MOD=1000000007; const int INF=0x3f3f3f3f; const int N=10010; const int M=100010; const double eps=1e-10; int n,m; int F[N]; int main() { int i,j,k; int flag; while(scanf("%d",&n)!=EOF) { memset(F,0,sizeof(F)); for (i=0;in-F[i]) flag=i; } if (flag!=-1) printf("%d\n",flag); else printf("-1\n"); } return 0; }