N = int(input())
*P, = map(int, input().split())

ans = 0
#貪欲法
for i in range(N-1):
    if (i+1)==P[i] or (i+2)==P[i+1]:
        temp = P[i]
        P[i] = P[i+1]
        P[i+1] = temp
        ans = ans + 1
print(ans)