n = int(input())
line = input()
v = []
v = [int(i) for i in line.split()]
ans = n
maior= 0
for k in range(1, n-1):
    if v[k] > maior:
        maior = v[k]
        iterador = k
for k in range(1, n):
    if v[k] < v[0] or (v[k] < maior and k > iterador):
        ans = ans - 1
print(ans)