N = int(input()) # 10**5
P = [int(x)-1 for x in input().split()]

# 1 4 3 5 2
# 1 2 3 4 5
# x o x o o

# 1 2 3
# x x x
# 2 1 3
# o o x

cnt = 0
i = 0
while i < N-1:
    if P[i] != i:
        P[i],P[i+1] = P[i+1],P[i]
        i+=1
    else: # P[i] == i
        P[i],P[i+1] = P[i+1],P[i]
        cnt += 1
        i+=2
if P[N-1] == N-1:
    cnt+=1
print(cnt)
