N = int(eval(input()))

P = list(map(int, input().split()))



ans = 0

mins = [10**6]

for i in P:

    v = min(mins[-1], i)

    mins.append(v)

mins.pop(0)



ans = 0

for i, j in zip(P, mins):

    if i <= j:

        ans += 1

print(ans)

from itertools import accumulate

N = int(eval(input()))

P = list(map(int, input().split()))



ans = 0

accmin = accumulate(P, min)

for i, j in zip(P, accmin):

    if i <= j:

        ans += 1

print(ans)

N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
mins = [10**6]
for i in P:
    v = min(mins[-1], i)
    mins.append(v)
mins.pop(0)
ans = 0
for i, j in zip(P, mins):
    if i <= j:
        ans += 1
print(ans)

from itertools import accumulate

N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
accmin = accumulate(P, min)
for i, j in zip(P, accmin):
    if i <= j:
        ans += 1
print(ans)

+from itertools import accumulate + -mins = [10**6] -for i in P: -    v = min(mins[-1], i) -    mins.append(v) -mins.pop(0) -ans = 0 -for i, j in zip(P, mins): +accmin = accumulate(P, min) +for i, j in zip(P, accmin):