import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))

res = 0
for i in range(N - 1):
  if a[i] == i + 1:
    res += 1
    a[i], a[i + 1] = a[i + 1], a[i]
print(res)