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