def insert_ordered(value, array):
    """
    This will insert the value into the array, keeping it sorted, and returning the
    index where it was inserted
    """
    index = 0
    for n in range(0, len(array)):
        if value >= array[n]:
            index = n + 1
    array.insert(index, value)
    return index
