n = int(input()) A = list(map(int,input().split())) sA = [[A[i],i] for i in range(n)] sA.sort() use = [0]*(n+1) ans = 0 for a,ind in sA: if use[ind+1]: continue ans += 1 use[ind] = 1 print(ans)