N = int(input()) pa = [int(s) for s in input().split()] pb = [0]*(N+1) for i in range(N): pb[i+1] = max(pb[i], pa[i]) n = 0 for i in range(N-1, -1, -1): if pa[i] < pb[i] or pa[i] < pb[0]: pb[0] = max(pb[0], pa[i]) n += 1 print(n)