n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if p[i] - 1 == i:
        count += 1
        if i != n-1:
            if p[i + 1] - 1 == i + 1:
                count -= 1
print(count)