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


if __name__ == '__main__':
    main()