def compute_min_run(n):
    """Compute min_run to use when sorting n total values."""
    # Used to add 1 if any remaining bits are set
    r = 0
    while n >= 64:
        r |= n & 1
        n >>= 1
    return n + r