def count_in_range(mylist: list, lb, ub):
    """
    Count the number of elements in the list in a given range, i.e. lb < x <= ub
    :param mylist: The list whose elements are to be counted
    :param lb: The lower bound of the range
    :param ub: The upper bound of the range
    :return: The number of elements in the list in a given range
    """
    return len([x for x in mylist if lb < x <= ub])