import sys
input = sys.stdin.readline
N = int(input())
p = [int(x) for x in input().split()]
cnt = 0
for i in range(N-1):
    if (i + 1) == p[i]:
        p[i], p[i+1] = p[i+1], p[i]
        cnt += 1
print(cnt)