N = int(input())
P = list(map(int, input().split()))
count = 0
while True:
    for i in range(N-1):
        if i + 1 == P[i]:
            P[i], P[i+1] = P[i+1], P[i]
            count += 1
    flag = True
    for i in range(1, N+1):
        if i == P[i-1]:
            flag = False
            break
    if flag:
        break

print(count)