def swap(a,b,c):
    x = a[b]
    a[b] = a[c]
    a[c] = x
 
     
n = input()
a = list(map(int,input().split()))
alen = len(a)
a.append(0.5)
a.append(0.5)
ans = 0
 
med = [0 for x in range(alen +3)]
 
for i in range(alen):
    if a[i] == i+1:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
          swap(a,a[i-1],a[i])
          med[i+1] == 0
          ans += 1
      else:
        swap(a,i,i+1)
        ans += 1
        
print(ans)