N = int(input()) A = [int(i) for i in input().split()] c = 0 for i in reversed(range(1, N)): if A[i] < A[i - 1]: c += 1 print(c)