N = int(input())
p = list(map(int, input().split()))

for i in range(N):
    p[i] -= 1

check = [0] * N

par = list(range(N))

for i in range(N):
    if p[i] == par[i]:
        check[i] = 1
    else:
        check[i] = 0

cnt = 0

for i in range(N-1):
    if check[i] == 1 and check[i+1] == 1:
        cnt += 1

print(sum(check) - cnt)