
    Given the number of vital sign measurements collected from an ICU patient's monitor, determine the smallest buffer size (which must be a power of 2) that can store all measurements without data loss for real-time processing. This optimization is crucial for the ICU monitoring system to efficiently process patient data and generate timely alerts for medical staff.
    

    
def next_power_of_2(n):
    """
    Given the number of vital sign measurements collected from an ICU patient's monitor, determine the smallest buffer size (which must be a power of 2) that can store all measurements without data loss for real-time processing. This optimization is crucial for the ICU monitoring system to efficiently process patient data and generate timely alerts for medical staff.
    

    """
def next_power_of_2(n):
    """
    Given the number of vital sign measurements collected from an ICU patient's monitor, determine the smallest buffer size (which must be a power of 2) that can store all measurements without data loss for real-time processing. This optimization is crucial for the ICU monitoring system to efficiently process patient data and generate timely alerts for medical staff.
    

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