import numpy as np
n = int(input())
L1 = np.array(list(map(int, input().split())))
L2 = np.arange(1, n + 1)
L3 = L1-L2
ans = 0
for i in range(n-1):
    if L3[i] == 0:
        ans +=1
        L3[i],L3[i+1] = -1,-1
print(ans)
