def count_non_hs_atoms(mol):
    """
    Count the number of atoms in a molecule excluding Hs.
    Parameters
    ----------
    mol: RDKit Mol object
        molecule

    Returns
    ----------
    ans: int
        number of non Hs atoms in the molecule.
    """
    ans = 0
    for atm in mol.GetAtoms():
        if atm.GetAtomicNum() != 1:
            ans += 1
    return ans