import sys

readline = sys.stdin.buffer.readline


def main():
    N = int(readline())
    P = list(map(int, readline().split()))
    P = list(map(lambda x: x-1, P))

    cnt = 0
    for i in range(N-1):
        if P[i] == i:
            P[i], P[i+1] = P[i+1], P[i]
            cnt += 1
    print(cnt)


main()
