# -*- coding: utf-8 -*-
n = int(input())
p = list(map(int, input().split()))

i = 0
ans = 1
while True:
    if p[i] == i + 1:
        p[i], p[i + 1] = p[i + 1], p[i]
        ans += 1
        i += 1
    else:
        i += 1
    if i == n - 1:
        break
print(ans - 1)
