def tcount(g):
    """Returns the amount of nodes in g that have a non-Clifford phase."""
    if not hasattr(g, 'vertices'):
        return g.tcount()
    count = 0
    phases = g.phases()
    for v in g.vertices():
        if phases[v] != 0 and phases[v].denominator > 2:
            count += 1
    return count
