def get_rare_elements_number(d, n):
    """
    Count the number of rare elements
    :param d: dictionary to use
    :param n: the threshold for rarity
    :return: the number of rare elements as a string
    """
    i = 0
    for k, v in d.items():
        if v < n:
            i += 1

    return str(i)