input()
a = list(map(int, input().split()))
count = 0

for i in range(len(a) - 1):
    if a[i] == i + 1:
        temp = a[i]
        a[i] = a[i + 1]
        a[i + 1] = temp
        count += 1
print(count)