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

ans = 0
cnt = 0
flag = 1
while flag:
    flag = 0
    for i in range(cnt, N):
        if P[i] == i+1:
            P[i], P[i+1] = P[i+1], P[i]
            ans += 1
            flag = 1
        else:
            cnt += 1
        if i+1 < N:
            if P[i+1] == i+2 and P[i] != i+2:
                P[i], P[i+1] = P[i+1], P[i]
                ans += 1
                flag = 1

print(ans)