n = int(input())
p = list(map(int, input().rstrip().split(" ")))
c = 0
f = 0
for i in range(n):
    if p[i] == i + 1:
        p[i] , p[i + 1] = p[i + 1] , p[i]
        c += 1
        f = i + 1
if p[n - 1] == n:
    c += 1
print(c)
