
    Given the number of potential friend connections in a social network's recommendation queue, determine the smallest batch size (which must be a power of 2) that can process all connections without splitting any relationship groups. The batch size must be greater than or equal to the current number of connections to maintain the integrity of the friend recommendation system's memory allocation.
    

    
def next_power_of_2(n):
    """
    Given the number of potential friend connections in a social network's recommendation queue, determine the smallest batch size (which must be a power of 2) that can process all connections without splitting any relationship groups. The batch size must be greater than or equal to the current number of connections to maintain the integrity of the friend recommendation system's memory allocation.
    

    """
def next_power_of_2(n):
    """
    Given the number of potential friend connections in a social network's recommendation queue, determine the smallest batch size (which must be a power of 2) that can process all connections without splitting any relationship groups. The batch size must be greater than or equal to the current number of connections to maintain the integrity of the friend recommendation system's memory allocation.
    

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