
    Design a function for the bank's fraud detection system that determines the minimum batch size (as a power of 2) needed to process a given number of incoming transactions, ensuring optimal memory allocation for pattern analysis. The batch size must be greater than or equal to the number of incoming transactions to maintain system efficiency and prevent data overflow.
    

    
def next_power_of_2(n):
    """
    Design a function for the bank's fraud detection system that determines the minimum batch size (as a power of 2) needed to process a given number of incoming transactions, ensuring optimal memory allocation for pattern analysis. The batch size must be greater than or equal to the number of incoming transactions to maintain system efficiency and prevent data overflow.
    

    """
def next_power_of_2(n):
    """
    Design a function for the bank's fraud detection system that determines the minimum batch size (as a power of 2) needed to process a given number of incoming transactions, ensuring optimal memory allocation for pattern analysis. The batch size must be greater than or equal to the number of incoming transactions to maintain system efficiency and prevent data overflow.
    

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