from math import ceil


def solve(n):
    c = 0
    p = [pi-1 for pi in map(int, input().split())]
    i = 0

    while i < n-2:
        if i == p[i]:
            c += 1
            if i+1 == p[i+1]:
                i += 1
        i += 1

    if p[n-1] == n-1:
        c += 1

    return c


if __name__ == '__main__':
    n = int(input())
    print(solve(n))
