def set_left_most_unset_bit(n):
    if n == 0:
        return 1
    
    # Find the position of the leftmost unset bit
    temp = n
    pos = -1
    bit_pos = 0
    
    while temp > 0:
        if not (temp & 1):
            pos = bit_pos
        temp >>= 1
        bit_pos += 1
    
    if pos == -1:
        # All bits are set, add a new bit at the top
        return n | (1 << bit_pos)
    
    return n | (1 << pos)