
    Design a function that determines the optimal memory block size (in powers of 2) needed to store friend recommendations, ensuring there's enough space to accommodate all potential matches while maintaining efficient memory allocation. Given a number of potential friend recommendations, the function should return the smallest power of 2 that can hold all recommendations without truncation.
    

    
def next_power_of_2(n):
    """
    Design a function that determines the optimal memory block size (in powers of 2) needed to store friend recommendations, ensuring there's enough space to accommodate all potential matches while maintaining efficient memory allocation. Given a number of potential friend recommendations, the function should return the smallest power of 2 that can hold all recommendations without truncation.
    

    """
def next_power_of_2(n):
    """
    Design a function that determines the optimal memory block size (in powers of 2) needed to store friend recommendations, ensuring there's enough space to accommodate all potential matches while maintaining efficient memory allocation. Given a number of potential friend recommendations, the function should return the smallest power of 2 that can hold all recommendations without truncation.
    

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