N = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(0,N,2):
    try:
        if p[i] == i+1 or p[i+1] == i+2:
            ans += 1
    except:
        if p[i] == i+1:
            ans += 1

print(ans)