def solve():
    N = int(input())
    p = list(map(int, input().split()))
    count = int(0)
    for i in range(N):
        if p[i] == i+1:
            p[i], p[i+1] = p[i+1], p[i]
            count += 1
    print(count)

if __name__ == '__main__':
    solve()
