n = int(input())
list_P = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if list_P[i] == i+1:
        a = list_P[i]
        b = list_P[i+1]
        list_P[i] = b
        list_P[i+1] = a
        ans += 1
print(ans)