def main():
    N = int(input())
    permutation = list(map(int, input().split()))
    condition = [0] * N
    answer = 0
    for i in range(N):
        if i + 1 == permutation[i]:
            condition[i] = 1
    for i in range(N - 1):
        if condition[i]:
            condition[i] = 0
            condition[i + 1] = 0
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()