n = input()

a = map(int, raw_input().split())

ct = 0

for i in range(len(a) - 1):
    if i + 1 == a[i]:
        a[i], a[i + 1] = a[i + 1], a[i]
        ct += 1

key = len(a)
if a[key - 1] == key:
    a[key - 1], a[key - 2] = a[key - 1], a[key - 2]
    ct += 1

print ct