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

ans = 0
if P[0] == 1 or P[1] == 2:
  P[0],P[1] = P[1],P[0]
  ans += 1

for i in range(1,len(P)):
  if P[i-1] == i or P[i] == i+1:
    P[i-1],P[i] = P[i],P[i-1]
    ans += 1

print(ans)