N = int(input())
p = [int(pi) for pi in input().split()]

def swap(x, y):
    tmp = x
    x = y
    y = tmp
    return x, y

count = 0
for i in range(len(p) - 1):
    if p[i] == i + 1:
        p[i], p[i+1] = swap(p[i], p[i+1])
        count += 1
print(count)