N = int(input())
p = list(map(int, input().split()))
result = 0
for i in range(0, N, 2):
    if (i +1 > N-1 and i+1 == p[i]) or (i+1<N and (i+1 == p[i] or i+2 == p[i+1])):
        result += 1
print(result)