with open("input.txt", 'r') as f:
    data = f.read().strip().split('\n')

    data_og = data
    for i in range(len(data_og[0])):
        sum_one = 0
        for n in data_og:
            sum_one += int(n[i])
        
        print(sum_one)

        if sum_one > (len(data_og)/2):
            data_og = [n for n in data_og if n[i] == "1"]
        elif sum_one < (len(data_og)/2):
            data_og = [n for n in data_og if n[i] == "0"]
        else:
            data_og = [n for n in data_og if n[i] == "1"]

        # print(data_og)

        if len(data_og) == 1:
            break

    
    data_cs = data
    for i in range(len(data_cs[0])):
        sum_one = 0
        for n in data_cs:
            sum_one += int(n[i])

        if sum_one < (len(data_cs)/2):
            data_cs = [n for n in data_cs if n[i] == "1"]
        elif sum_one > (len(data_cs)/2):
            data_cs = [n for n in data_cs if n[i] == "0"]
        else:
            data_cs = [n for n in data_cs if n[i] == "0"]

        # print(data_cs)

        if len(data_cs) == 1:
            break
    
    print(f"{data_og} {data_cs}")

    print(int(data_og[0], 2) * int(data_cs[0], 2))

    # oc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    # zc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    # for n in data:
    #     for i, d in enumerate(n):
    #         if d == "1":
    #             oc[i] += 1
    #         else:
    #             zc[i] += 1

    # c = list(zip(zc, oc))

    # gs = ""
    # es = ""

    # for p in c:
    #     if p[0] > p[1]:
    #         gs += "0"
    #         es += "1"
    #     else:
    #         gs += "1"
    #         es += "0"

    # print(f"{gs} {es}")

    # print(f"{int(gs, 2) * int(es, 2)}")

    


