import numpy as np
N = int(input())
p = list(input().split())
p = [int(i) for i in p]
same_i = []
for i in range(len(p)):
    if p[i] == int(i+1):
        same_i.append(int(i+1))

renzoku = []
for i in range(len(same_i)-1):
    if same_i[i]+1 == same_i[i+1]:
        renzoku.append(same_i[i])
print(len(same_i)-len(renzoku))