N = int(input())
p = [int(_) - 1 for _ in input().split()]

r = 0

i = 0
while i < N:
    if p[i] == i:
        if i + 1 == N:
            p[i - 1], p[i] = p[i], p[i - 1]
            r += 1
        elif i == 0:
            p[i + 1], p[i] = p[i], p[i + 1]
            r += 1
        else:
            p[i - 1], p[i] = p[i], p[i - 1]
            r += 1
    i += 1

#print(p)
print(r)
