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


if __name__ == '__main__':
    main()
