N = int(input())
p = [int(x) for x in input().split()]

l = []

for i in range(len(p)):
    if p[i] == i + 1:
        l.append(p[i])
    else:
        l.append(0)

count = 0
for i in renge(len(l)):
    if l[i] > 0:
        l[i] = 0
        l[i + 1] = 0
        count += 1
print(count)

