s = list(input())
one  = s.count("1")
zero = s.count("0")
if(one == 0 or zero == 0):
    print("0")
else:
    if (one > zero):
        print(zero * 2)
    else:
        print(one * 2) s = list(input()) s list(input()) list input() input one  = s.count("1") one s.count("1") s.count s count "1" zero = s.count("0") zero s.count("0") s.count s count "0" if(one == 0 or zero == 0):
    print("0")
else:
    if (one > zero):
        print(zero * 2)
    else:
        print(one * 2) one == 0 or zero == 0 one == 0 one 0 zero == 0 zero 0 print("0") print "0" if (one > zero):
        print(zero * 2)
    else:
        print(one * 2) one > zero one zero print(zero * 2) print zero * 2 zero 2 print(one * 2) print one * 2 one 2 s = list(input()) list(input()) s one  = s.count("1") s.count("1") one zero = s.count("0") s.count("0") zero
s = list(input())
one  = s.count("1")
zero = s.count("0")
if(one == 0 or zero == 0):
    print("0")
else:
    if (one > zero):
        print(zero * 2)
    else:
        print(one * 2)
