N = int(input())
p = list(map(int, input().split()))
i = 0
ans = 0
while(i < N - 1):
    print(p)
    print(' ' * (3 * i + 1) + str(i + 1))
    if p[i] == i + 1:
        ans += 1
        p[i], p[i + 1] = p[i + 1], p[i]
    i += 1
if p[N - 1] == N:
    ans += 1
print(ans)