N = int(input()) P = list(map(int, input().split())) ans = 0 for i in range(1,N): if sorted(P[:i+1]) != sorted(P[:i]) + [P[i]]: ans += 1 print(ans)