import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    P = [int(p) for p in input().split()]
    swap = 0
    i = 0
    while i < N:
        if P[i] == i + 1:
            P[i], P[i+1] = P[i+1], P[i]
            swap += 1
        i += 1
    print(swap)
    return 0

if __name__ == "__main__":
    solve()