def _partition_1(list_):
    """
    Rearrange list_ so that items < list_[0] are at the beginning
    and items >= list_[0] are at the end, and return the new index
    for list_[0].

    @param list list_: list to partition
    @rtype: int

    >>> _partition_1([2, 1, 3])
    1
    """
    v = list_[0]
    i = 1
    j = len(list_) - 1
    while i <= j:
        if list_[i] < v:
            i += 1
        else:
            list_[i], list_[j] = list_[j], list_[i]
            j -= 1
    list_[0], list_[j] = list_[j], list_[0]
    return j