
    Given a class size, determine the minimum group capacity (which must be a power of 2) needed to accommodate all students in equal-sized peer study groups without leaving any student out. The group size should be the smallest possible power of 2 that can fit all students to ensure optimal peer learning interactions.
    

    
def next_power_of_2(n):
    """
    Given a class size, determine the minimum group capacity (which must be a power of 2) needed to accommodate all students in equal-sized peer study groups without leaving any student out. The group size should be the smallest possible power of 2 that can fit all students to ensure optimal peer learning interactions.
    

    """
def next_power_of_2(n):
    """
    Given a class size, determine the minimum group capacity (which must be a power of 2) needed to accommodate all students in equal-sized peer study groups without leaving any student out. The group size should be the smallest possible power of 2 that can fit all students to ensure optimal peer learning interactions.
    

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