N = int(input()) A = list(map(int,input().split())) ans = 0 now = -1 for i in range(N): if(now > A[i]): ans += 1 else: now = A[i] print(ans)