n = int(input()) s = list(map(int, input().split())) cnt = 1 tmp = s[0] for i in range(n): if tmp < s[i]: cnt += 1 tmp = s[i] print(n - cnt)