import numpy as np
N = int(input())
p = list(input().split())
p = [int(i) for i in p]
cnt = 0
for i in range(len(p)):
    if p[i] == int(i+1):
        now_pi = p[i]
        swap_pt = np.random.randint(0, len(p))
        p[i] = p[swap_pt]
        p[swap_pt] = now_pi
        cnt += 1
print(cnt)