N = input() a = map(int , raw_input().split()) count = 0 look = a[0] for i in range(N - 1): if look > a[i + 1]: count += 1 else: look = a[i + 1] print count