n = int(input())
d = list(map(int, input().split()))
res = 0
for i in range(n - 1):
    if d[i] == (i + 1):  # もし同じ子がいたら
        d[i], d[i + 1] = d[i + 1], d[i]
        res += 1
if d[n-1] == len(d):
    d[n-2], d[n-1] = d[n-1], d[n-2]
print(res)