# ABC072 D - Derangement
N = int(input())
P = list(map(int,input().split()))

ans = 0
is_renzoku = False

for i in range(N-1):
    if not is_renzoku:
        if P[i] == i+1:
            ans += 1
            if P[i+1] == i+2:
                is_renzoku = True
    else:
        is_renzoku = False
print(ans)