# t=int(input())
# for _ in range(t):
n=int(input())
arr=[int(x) for x in input().split()]
maxa=arr[0]
count=0
for i in range(n):
    if arr[i] > maxa:
        maxa=arr[i]
    else:
        count+=1
print(count)
