def toggle_middle_bits(n):
    def set_middle_bits(n):  
        n |= n >> 1; 
        n |= n >> 2; 
        n |= n >> 4; 
        n |= n >> 8; 
        n |= n >> 16;  
        return (n >> 1) ^ 1
     
    if (n == 1): 
        return 1
    return n ^ set_middle_bits(n) 
def toggle_middle_bits(VAR_0):
    def set_middle_bits(VAR_0):
        VAR_0 |= VAR_0 >> 1
        VAR_0 |= VAR_0 >> 2
        VAR_0 |= VAR_0 >> 4
        VAR_0 |= VAR_0 >> 8
       
        VAR_0 |= VAR_0 >> 16
        return (VAR_0 >> 1) ^ 1
    if VAR_0 == 1:
        return 1
    return VAR_0 ^ set_middle_bits(VAR_0)