n = int(input())
list_P = list(map(int, input().split()))
ans = 0
while True:
    cnt = 0
    for i in range(n-1):
        if list_P[i] == i+1:
            a = list_P[i]
            b = list_P[i+1]
            list_P[i] = b
            list_P[i+1] = a
            ans += 1
        else:
            cnt += 1
    if cnt == n-1:
        break
print(ans)