import sys
input = sys.stdin.readline

N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i, p in enumerate(P):
    num = i + 1
    if num != p:
        continue
    else:
        next = P[i+1]
        tmp = P[i]
        P[i] = P[i+1]
        P[i+1] = tmp
        cnt += 1
print(cnt)
