# coding: utf-8

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

need = 0

for i in range(N):
    if(p[i] == i + 1):
        need += 1
        if(i > 0):
            if(p[i - 1] == i):
                need -= 1

print(need)
