N,*A=map(int,open(0).read().split()) A+=[2e9] b=1 while A[b-1]>=A[b]:b+=1 print(A[:b].count(A[b-1]))