import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input().strip())
    P = [int(i) for i in input().strip().split()]
    ptr = 0
    cnt = 0
    while ptr < N:
        if P[ptr] == ptr + 1:
            if ptr != 0 and P[ptr - 1] != ptr and P[ptr - 1] != ptr + 1:
                P[ptr], P[ptr - 1] = P[ptr - 1], P[ptr]
                cnt += 1
            elif ptr < N - 1 and P[ptr + 1] != ptr + 1 and P[ptr] != ptr + 2:
                P[ptr], P[ptr + 1] = P[ptr + 1], P[ptr]
                cnt += 1
        ptr += 1
    print(cnt)
    return


if __name__ == "__main__":
    main()