def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    cnt = 0
    for i in range(N-1):
        if P[i] == i+1:
            P[i],P[i+1] = P[i+1],P[i]
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()