N = int(input())
p_li = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1, 2):
    if i < N:
        if p_li[i] == i + 1 or p_li[i - 1] == i:
            ans += 1
    else:
        if p_li[i - 1] == i:
            ans += 1
print(ans)
