
    Given the number of waiting passengers at a bus stop, determine the minimum bus capacity needed, where bus capacities are available only in powers of 2 (16, 32, 64, etc.), to ensure all passengers can be accommodated. The selected bus capacity must be large enough to transport all waiting passengers in a single trip while minimizing wasted seats.
    

    
def next_power_of_2(n):
    """
    Given the number of waiting passengers at a bus stop, determine the minimum bus capacity needed, where bus capacities are available only in powers of 2 (16, 32, 64, etc.), to ensure all passengers can be accommodated. The selected bus capacity must be large enough to transport all waiting passengers in a single trip while minimizing wasted seats.
    

    """
def next_power_of_2(n):
    """
    Given the number of waiting passengers at a bus stop, determine the minimum bus capacity needed, where bus capacities are available only in powers of 2 (16, 32, 64, etc.), to ensure all passengers can be accommodated. The selected bus capacity must be large enough to transport all waiting passengers in a single trip while minimizing wasted seats.
    

    """
    if n and (not n & n - 1):
        return n
    count = 0
    while n != 0:
        n >>= 1
        count += 1
    return 1 << count