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

def swap(a, b):
    mem = a
    a = b
    b = mem
    return a, b
P = [0] + P
count = 0
for i in range(1, N):
    now = P[i]
    after = P[i+1]
#    print(i, now, after)
    if now == i:
#        print('hit')
        count += 1
        P[i], P[i+1] = swap(now, after)
if P[-1] == N:
    P[-2], P[-1] = swap(P[-1], P[-2])
print(count)