# size = 3
# obj = (1,2,4)
size = 12
objs = (2376, 1812, 1106, 563, 1536) 

ope = 0
inter = [False,] * size
res = dict()

def switch(inter, i, type):
    global ope
    global objs
    global res
    if i < 0 or i > len(inter)-1:
        raise RuntimeError("Mmmmmm")
    s_old = "".join(["0" if not x else "1" for x in inter])
    inter[i] = not inter[i]
    ope = ope + 1
    s = "".join(["0" if not x else "1" for x in inter])
    if ope in objs:
        res[ope] = int(s,2)
    print("Operation #{:05d} ({}) - Switch #{:02d}: {} ==> {}".format(ope, type, i, s_old, s))
    return inter

def action1(inter):
    inter = switch(inter, 0, "a1")
    return inter

def action2(inter):
    i = 0
    while inter[i] == False:
        i=i+1
    inter = switch(inter, i+1, "a2")
    return inter

def set_all_off(inter, i):
    if i <0:
        return inter
    # print("set_all_off", i)
    if i > 0:
        if inter[i] == False:
            inter = set_all_off(inter, i-1)
        else:
            inter = set_inter(inter, i-1)
            inter = set_all_off(inter, i-2)
            inter = action2(inter)
            inter = set_all_off(inter, i-1)
    elif i == 0:
        if inter[0] == True:
            inter = action1(inter)
    # print("end set_all_off", i)
    return inter

def set_inter(inter, i):
    if i < 0:
        return inter
    # print("set_inter", i)
    if inter[i] == True:
        return inter
    if i > 0:
        inter = set_inter(inter, i-1)
        inter = set_all_off(inter, i-2)
        inter = action2(inter)
    else:
        inter = action1(inter)
    # print("end set_inter", i)
    return inter

for i in range(0, size):
    inter = set_inter(inter, size-1-i)
for obj in objs:
    print(res[obj], end=', ')