N = int(input())
p = list(map(int, input().split()))


def swap(lis, pos1, pos2):
    lis[pos1], lis[pos2] = lis[pos2], lis[pos1]
    return lis


ans = 0

for i in range(N-1):
    if p[i] == i+1:
        p = swap(p, i, i+1)
        ans += 1
print(ans)
