n = int(input())
a = [int(x)-1 for x in input().split(' ')]
pos = [-1] * n
for i, x in enumerate(a):
pos[x] = i
mn = n
mx = -1
res = 0
for i in range(n):
mn = min(mn, pos[i])
mx = max(mx, pos[i])
cur = mx - mn + 1
if cur == i + 1: res += 1
print(res)