qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
from collections import defaultdict


def main():

    n = int(input())

    v = list(map(int, input().split(' ')))

    odd = defaultdict(int)
    even = defaultdict(int)

    for i, num in enumerate(v):
        # print(i % 2)
        if (i % 2) == 0:
            even[num] += 1
        elif (i % 2) == 1:
            # print(i, ": ", num)
            odd[num] += 1

    x = sorted(even.items(), key=lambda x: x[1], reverse=True)
    y = sorted(odd.items, key=lambda x: x[1], reverse=True)

    if x[0][0] != y[0][0]:
        ans = n - x[0][1] - y[0][1]
    else:
        ans = n - max(x[0][1] + y[1][1], x[1][1] + y[0][1])

    print(ans)


main()


# Fixed code:
from collections import defaultdict


def main():

    n = int(input())

    v = list(map(int, input().split(' ')))

    odd = defaultdict(int)
    even = defaultdict(int)
    odd[0] = 0
    even[0] = 0

    for i, num in enumerate(v):
        # print(i % 2)
        if (i % 2) == 0:
            even[num] += 1
        elif (i % 2) == 1:
            # print(i, ": ", num)
            odd[num] += 1

    a = sorted(even.items(), key=lambda x: x[1], reverse=True)
    b = sorted(odd.items(), key=lambda x: x[1], reverse=True)

    if a[0][0] != b[0][0]:
        ans = n - a[0][1] - b[0][1]
    else:
        ans = n - max(a[0][1] + b[1][1], a[1][1] + b[0][1])

    print(ans)


main()
# Buggy code:
import collections

n = int(input())
v = [int(i) for i in input().split()] 

odd=v[1::2]
even=v[::2]

if len(collections.Counter(v)):
    max_eq = max(len(odd),len(even))
    print(n - max_eq)
    exit()

odd_most = collections.Counter(odd).most_common(2)
even_most = collections.Counter(even).most_common(2)

max_count=0
for odd_top in odd_most:
    for even_top in even_most:
        max_count = max(max_count,odd_top[1]+even_top[1])
print(n-max_count)

# Fixed code:
import collections

n = int(input())
v = [int(i) for i in input().split()] 

odd=v[1::2]
even=v[::2]

if len(collections.Counter(v))==1:
    max_eq = max(len(odd),len(even))
    print(n - max_eq)
    exit()

odd_most = collections.Counter(odd).most_common(2)
even_most = collections.Counter(even).most_common(2)

max_count=0
for odd_top in odd_most:
    for even_top in even_most:
        if odd_top[0] == even_top[0]:
            continue
        max_count = max(max_count,odd_top[1]+even_top[1])
print(n-max_count)
# Buggy code:
def sura_backsura():
    import collections

    N = int(input())
    a = [int(i) for i in input().split()]

    fp = collections.Counter(a[0::2]).most_common()
    sp = collections.Counter(a[1::2]).most_common()

    if fp[0] != sp[0]:
        count = N - fp[0][1] - sp[0][1]
    else:
        count = min(N - fp[0][1] - sp[1][1], N - fp[1][1] - sp[0][1])

    print(count)
    
if __name__ == "__main__":
    sura_backsura()

# Fixed code:
def sura_backsura():
    import collections

    N = int(input())
    a = [int(i) for i in input().split()]

    fp = collections.Counter(a[0::2]).most_common()
    sp = collections.Counter(a[1::2]).most_common()

    fp.append((0, 0))
    sp.append((0, 0))

    if fp[0] != sp[0]:
        count = N - fp[0][1] - sp[0][1]
    else:
        count = min(N - fp[0][1] - sp[1][1], N - fp[1][1] - sp[0][1])

    print(count)
    
if __name__ == "__main__":
    sura_backsura()
# Buggy code:
from corections import Counter 
n = int(input())
v = list(map(int,input().split()))
 
odd = []
even = []
for i in range(n//2):
	odd.append(v[2*i+1])
	even.append(v[2*i])
 
odd = sorted(odd)
even = sorted(even)
ac = Counter(odd).most_common(2)
bc = Counter(even).most_common(2)
def cnt(X):
	count = 0
	ans = 0
	for i in range(len(X)-1):
		if X[i+1] == X[i]:
			count += 1
			ans = max(ans,count)
		else:
			count = 0
	return ans+1
            
if ac[0][0] != bc[0][0]:
  print(len(v)-cnt(odd)-cnt(even))
elif len(ac) == 1 and len(bc) == 1:
	print(n//2)
else:
	print(n-max(ac[0][1]+bc[1][1],ac[1][1]+bc[0][1]))

# Fixed code:
from collections import Counter 
n = int(input())
v = list(map(int,input().split()))
 
odd = []
even = []
for i in range(n//2):
	odd.append(v[2*i+1])
	even.append(v[2*i])

odd = sorted(odd)
even = sorted(even)
ac = Counter(odd).most_common(2)
bc = Counter(even).most_common(2)
def cnt(X):
	count = 0
	ans = 0
	for i in range(len(X)-1):
		if X[i+1] == X[i]:
			count += 1
			ans = max(ans,count)
		else:
			count = 0
	return ans+1
            
if ac[0][0] != bc[0][0]:
  print(len(v)-cnt(odd)-cnt(even))
elif len(ac) == 1 and len(bc) == 1:
	print(n//2)
else:
	print(n-max(ac[0][1]+bc[1][1],ac[1][1]+bc[0][1]))
# Buggy code:
from collections import Counter
n = int(input())
v = [int(i) for i in input().split()]
e = []
o = []
for i, a in enumerate(v):
    if i % 2:
        o.append(a)
    else:
        e.append(a)
oc = Counter(o)
ec = Counter(e)
h = n//2
if oc.most_common(1)[0][0] != ec.most_common(1)[0][0]:
    a = h - oc.most_common(1)[0][1]
    b = h - ec.most_common(1)[0][1]
    print(a+b)
else:
    E1 = E2 = 0
    for i, (k, v) in ec.most_common(2):
        if i == 0:
            E2 = E1 = k
        else:
            E2 = k
    O1 = O2 = 0
    for i, (k, v) in oc.most_common(2):
        if i == 0:
            O2 = O1 = k
        else:
            O2 = k
    print(min(h-ec[E1] + h - oc[O2], h - ec[E2] + h - oc[O1]))

# Fixed code:
from collections import Counter
n = int(input())
v = [int(i) for i in input().split()]
e = []
o = []
for i, a in enumerate(v):
    if i % 2:
        o.append(a)
    else:
        e.append(a)
oc = Counter(o)
ec = Counter(e)
h = n//2
if oc.most_common(1)[0][0] != ec.most_common(1)[0][0]:
    a = h - oc.most_common(1)[0][1]
    b = h - ec.most_common(1)[0][1]
    print(a+b)
else:
    if len(oc) == 1:
        print(h)
        exit()
    E1 = E2 = 0
    for i, (k, v) in enumerate(ec.most_common(2)):
        if i == 0:
            E2 = E1 = k
        else:
            E2 = k
    O1 = O2 = 0
    for i, (k, v) in enumerate(oc.most_common(2)):
        if i == 0:
            O2 = O1 = k
        else:
            O2 = k
    print(min(h-ec[E1] + h - oc[O2], h - ec[E2] + h - oc[O1]))
# Buggy code:
import heapq
import collections
n = int(input())
v = list(map(int, input().split()))

cnts = [collections.Counter(v[::2]), collections.Counter(v[1::2])]

hs = [[], []]
for i in range(2):
    for k, c in cnts[i].items():
        heapq.heappush(hs[i], (-c, k))
h0 = heapq.heappop(hs[0])
h1 = heapq.heappop(hs[1])
if h0[1] == h1[1]:
    if not hs[0] and not hs[1]:
        print(n//2)
    elif not hs[0]:
        print(n+h1[0])
    elif not hs[1]:
        print(n+h0[0])
    else:
        n0 = heapq.heappop(hs[0])
        n1 = heapq.heappop(hs[1])
        print(n - max(-h0[0]-n1[0], -n0[0]-h1[0]))
else:
    print(n-(h0[0]+h1[0]))


# Fixed code:
import heapq
import collections
n = int(input())
v = list(map(int, input().split()))

cnts = [collections.Counter(v[::2]), collections.Counter(v[1::2])]

hs = [[], []]
for i in range(2):
    for k, c in cnts[i].items():
        heapq.heappush(hs[i], (-c, k))
h0 = heapq.heappop(hs[0])
h1 = heapq.heappop(hs[1])
if h0[1] == h1[1]:
    if not hs[0] and not hs[1]:
        print(n//2)
    elif not hs[0]:
        print(n+h1[0])
    elif not hs[1]:
        print(n+h0[0])
    else:
        n0 = heapq.heappop(hs[0])
        n1 = heapq.heappop(hs[1])
        print(n + min(h0[0]+n1[0], n0[0]+h1[0]))
else:
    print(n+(h0[0]+h1[0]))
# Buggy code:
N = int(input())
lst = list(map(int, input().split()))

dic1, dic2 = dict(), dict()
for i, x in enumerate(lst):
    dic = dic1 if  i%2 == 0 else dic2
    if x not in dic.keys():
        dic[x] = 1
    else:
        dic[x] += 1
#print (type(dic1))
dic1 =sorted(dic1.items(), key = lambda x:x[1])[::-1]
dic2 =sorted(dic2.items(), key = lambda x:x[1])[::-1]

#print (type(dic2))
#print (dic1)
#print (dic2)

if dic1[0][0] != dic2[0][0]:
    print (N-dic1[0][1]-dic2[0][1])
elif len(dic1) == 1 and len(dic2) == 1:
    print (n//2)
elif len(dic1) == 1:
    print (N-dic1[0][1]-dic2[1][1])
elif len(dic2) == 1:
    print (N-dic1[1][1]-dic2[0][1])
else:
    print (max(N-dic1[0][1]-dic2[1][1], N-dic1[1][1]-dic2[0][1]))


# Fixed code:
N = int(input())
lst = list(map(int, input().split()))

dic1, dic2 = dict(), dict()
#dic1[0] = 0
#dic2[0] = 0
for i, x in enumerate(lst):
    dic = dic1 if  i%2 == 0 else dic2
    if x not in dic.keys():
        dic[x] = 1
    else:
        dic[x] += 1
#print (type(dic1))
dic1 =sorted(dic1.items(), key = lambda x:x[1])[::-1]
dic2 =sorted(dic2.items(), key = lambda x:x[1])[::-1]

#print (type(dic2))
#print (dic1)
#print (dic2)

if dic1[0][0] != dic2[0][0]:
    print (N-dic1[0][1]-dic2[0][1])
elif len(dic1) == 1 and len(dic2) == 1:
    print (N//2)
elif len(dic1) == 1:
    print (N-dic1[0][1]-dic2[1][1])
elif len(dic2) == 1:
    print (N-dic1[1][1]-dic2[0][1])
else:
    print (min(N-dic1[0][1]-dic2[1][1], N-dic1[1][1]-dic2[0][1]))
# Buggy code:
n=int(input())
v=list(map(int,input().split()))
w=[]
for i in range(n//2):
    w.append(v.pop(i))
print(v)
print(w)
import collections
cv = collections.Counter(v)
cw = collections.Counter(w)
scv = sorted(cv.items(), key=lambda x:-x[1])
scw = sorted(cw.items(), key=lambda x:-x[1])

v1=scv[0][0]
w1=scw[0][0]

if v1==w1:
    if len(scv)==1:
        v2=0
    else:
        v2=scv[1][1]
    if len(scw)==1:
        w2=0
    else:
        w2=scw[1][1]
        
    print(min(n-scv[0][1]-w2, n-scw[0][1]-v2))
        
else:
    print(n-scv[0][1]-scw[0][1])

# Fixed code:
n=int(input())
v=list(map(int,input().split()))
w=[]
for i in range(n//2):
    w.append(v.pop(i))

import collections
cv = collections.Counter(v)
cw = collections.Counter(w)
scv = sorted(cv.items(), key=lambda x:-x[1])
scw = sorted(cw.items(), key=lambda x:-x[1])

v1=scv[0][0]
w1=scw[0][0]

if v1==w1:
    if len(scv)==1:
        v2=0
    else:
        v2=scv[1][1]
    if len(scw)==1:
        w2=0
    else:
        w2=scw[1][1]
        
    print(min(n-scv[0][1]-w2, n-scw[0][1]-v2))
        
else:
    print(n-scv[0][1]-scw[0][1])
# Buggy code:
import collections
c = collections.Counter

N = int(input())
v = list(map(int,input().split()))

v_odd = v[::2]
v_eve = v[1::2]

c1 = c(v_odd).most_common(2)
c2 = c(v_eve).most_common(2)

if len(c1) == 1 and len(c2) == 1:
    ans = int(N/2)
else:
    if c1[0] != c2[0]:
        ans = N - c1[0][1] - c2[0][1]
    else:
        if c1[1][1] >= c2[1][1]:
            ans = N - c1[1][1] - c2[0][1]
        else:
            ans = N - c1[0][1] - c2[1][1]

print(ans)

# Fixed code:
import collections
c = collections.Counter

N = int(input())
v = list(map(int,input().split()))

v_odd = v[::2]
v_eve = v[1::2]

c1 = c(v_odd).most_common(2)
c2 = c(v_eve).most_common(2)

if len(c1) == 1 and len(c2) == 1:
    if c1[0][0] != c2[0][0]:
        ans = 0
    else:
        ans = int(N/2)
else:
    if c1[0] != c2[0]:
        ans = N - c1[0][1] - c2[0][1]
    else:
        if c1[1][1] >= c2[1][1]:
            ans = N - c1[1][1] - c2[0][1]
        else:
            ans = N - c1[0][1] - c2[1][1]

print(ans)
# Buggy code:
import collections
import sys
n = int(input())
a = list(map(int,input().split()))
#if len(set(a)) == 1:
 # print(n//2)
 # sys.exit()
a1 = [a[x] for x in range(0,n,2)]
l_a1 = len(a1)
a2 = [a[y] for y in range(1,n,2)]
l_a2 = len(a2)
c1 = collections.Counter(a1)
c2 = collections.Counter(a2)
K_a1 = c1.most_common()[0][0]
#print(K_a1)
K_a2 = c2.most_common()[0][0]
#print(K_a2)
F_a1 = c1.most_common(1)[0][1]
F_a2 = c2.most_common(1)[0][1]
if K_a1 == K_a2:
  if  c1.most_common(2)[0][1] >= c2.most_common(2)[0][1]:
    F_a2 = c2.most_common()[1][1]
  else:
    F_a1 = c1.most_common()[1][1]
   # print(F_a1)
print((l_a1 - F_a1)+(l_a2 - F_a2))

# Fixed code:
import collections
import sys
n = int(input())
a = list(map(int,input().split()))
if len(set(a)) == 1:
  print(n//2)
  sys.exit()
a1 = [a[x] for x in range(0,n,2)]
l_a1 = len(a1)
a2 = [a[y] for y in range(1,n,2)]
l_a2 = len(a2)
c1 = collections.Counter(a1)
c2 = collections.Counter(a2)
K_a1 = c1.most_common()[0][0]
K_a2 = c2.most_common()[0][0]
F_a1 = c1.most_common()[0][1]
F_a2 = c2.most_common()[0][1]
if K_a1 == K_a2:
  if  F_a1 > F_a2:
    F_a2 = c2.most_common()[1][1]
  elif F_a1 == F_a2:
    if  c1.most_common()[1][1] >  c2.most_common()[1][1]:
      F_a1 =  c1.most_common()[1][1]
    else:
      F_a2 =  c2.most_common()[1][1]
  else:
    F_a1 = c1.most_common()[1][1]
print((l_a1 - F_a1)+(l_a2 - F_a2))
# Buggy code:
N = int(input())
V = list(map(int, input().split()))
h = N//2

from collections import Counter
A = Counter(V[::2])
B = Counter(V[1::2])

ac = sorted(A.items(), key=lambda x: -x[1])
bc = sorted(B.items(), key=lambda x: -x[1])

if len(ac) == 1 and len(bc) == 1:
    print(h)
elif len(ac) == 1:
    print(h-bc[0][1])
elif len(bc) == 1:
    print(h-ac[0][1])
elif ac[0][0] == bc[0][0]:
    if ac[0][1]-ac[1][1] == bc[0][1]-bc[1][1]:
        if ac[0][1] >= bc[0][1]:
            print((h-ac[0][1]) + (h-bc[1][1]))
        else:
            print((h-ac[1][1]) + (h-bc[0][1]))
    elif ac[0][1]-ac[1][1] > bc[0][1]-bc[1][1]:
        print((h-ac[0][1]) + (h-bc[1][1]))
    else:
        print((h-ac[1][1]) + (h-bc[0][1]))
else:
    print((h-ac[0][1]) + (h-bc[0][1]))

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
h = N//2

from collections import Counter
A = Counter(V[::2])
B = Counter(V[1::2])

ac = sorted(A.items(), key=lambda x: -x[1])
bc = sorted(B.items(), key=lambda x: -x[1])

if len(ac) == 1 and len(bc) == 1:
    if ac[0][0] == bc[0][0]:
        print(h)
    else:
        print(0)
elif len(ac) == 1:
    print(h-bc[0][1])
elif len(bc) == 1:
    print(h-ac[0][1])
elif ac[0][0] == bc[0][0]:
    if ac[0][1]-ac[1][1] == bc[0][1]-bc[1][1]:
        if ac[0][1] >= bc[0][1]:
            print((h-ac[0][1]) + (h-bc[1][1]))
        else:
            print((h-ac[1][1]) + (h-bc[0][1]))
    elif ac[0][1]-ac[1][1] > bc[0][1]-bc[1][1]:
        print((h-ac[0][1]) + (h-bc[1][1]))
    else:
        print((h-ac[1][1]) + (h-bc[0][1]))
else:
    print((h-ac[0][1]) + (h-bc[0][1]))
# Buggy code:
from collections import defaultdict
n = int(input())
v = list(map(int, input().split()))
o = defaultdict(int)
e = defaultdict(int)
odd_num = 0
even_num = 0
for i, v_one in enumerate(v):
  if i % 2 == 1:
    o[v_one] += 1
    odd_num += 1
  else:
    e[v_one] += 1
    even_num += 1
sorted_o = sorted(o.items(), key=lambda x:-x[1])
sorted_e = sorted(e.items(), key=lambda x:-x[1])
if sorted_o[0][0] != sorted_e[0][0]:
  ans = odd_num - sorted_o[0][1] + even_num - sorted_e[0][1]
else:
  ans1 = odd_num - sorted_o[1][1] + even_num - sorted_e[0][1]
  ans2 = odd_num - sorted_o[0][1] + even_num - sorted_e[1][1]
  ans = min(ans1, ans2)
print(ans)

# Fixed code:
from collections import defaultdict
n = int(input())
v = list(map(int, input().split()))
o = defaultdict(int)
e = defaultdict(int)
odd_num = 0
even_num = 0
for i, v_one in enumerate(v):
  if i % 2 == 1:
    o[v_one] += 1
    odd_num += 1
  else:
    e[v_one] += 1
    even_num += 1
sorted_o = sorted(o.items(), key=lambda x:-x[1])
sorted_e = sorted(e.items(), key=lambda x:-x[1])
if sorted_o[0][0] != sorted_e[0][0]:
  ans = odd_num - sorted_o[0][1] + even_num - sorted_e[0][1]
elif len(sorted_o) >= 2 and len(sorted_e) >= 2:
  ans1 = odd_num - sorted_o[1][1] + even_num - sorted_e[0][1]
  ans2 = odd_num - sorted_o[0][1] + even_num - sorted_e[1][1]
  ans = min(ans1, ans2)
elif len(sorted_o) >= 2:
  ans = sorted_o[0][1]
elif len(sorted_e) >=2:
  ans = sorted_e[0][1]
else:
  ans = odd_num
print(ans)
# Buggy code:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common(2)
b = Counter(v[1::2]).most_common(2)
if a[0][0] == b[0][0]:
    if a[1][1] > b[1][1]:
        print(n - a[1][1] - b[0][1])
    else:
        print(n - a[0][1] - b[1][1])
else:
    print(n- a[0][1] - b[0][1])

# Fixed code:
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
a = Counter(v[::2]).most_common()
b = Counter(v[1::2]).most_common()
if len(a) == 1:
    a.append([0, 0])
if len(b) == 1:
    b.append([0, 0])
if a[0][0] == b[0][0]:
    if a[1][1] > b[1][1]:
        print(n - a[1][1] - b[0][1])
    else:
        print(n - a[0][1] - b[1][1])
else:
    print(n- a[0][1] - b[0][1])
# Buggy code:
A =list(map(int, input().split()))
A.sort()
print(A)
print(A[2]*10+A[1]+A[0])

# Fixed code:
A=list(map(int,input().split()))
A.sort()

print(A[0]+A[1]+A[2]*10)
# Buggy code:
a,b,c = map(int, input().split())

ans = []

ans.append(10*a+b+c)
ans.append(10*b+a+c)
ans.append(10*c+b+c)

print(max(ans))

# Fixed code:
a,b,c = map(int, input().split())

ans = []

ans.append(10*a+b+c)
ans.append(10*b+c+a)
ans.append(10*c+a+b)

print(max(ans))
# Buggy code:
a,b,c=map(int ,input().split())
maxs=a*10+b+c
maxs=max(a+b*10+c,maxs)
print(maxs)

# Fixed code:
a,b,c=map(int ,input().split())
maxs=a*10+b+c
maxs=max(a+b*10+c,maxs)
maxs=max(a+b+c*10,maxs)
print(maxs)
# Buggy code:
a,b,c = sorted(map(int,input().split()))

print(10*a+b+c)

# Fixed code:
a,b,c = sorted(map(int,input().split()))

print(10*c+b+a)
# Buggy code:
l=list(map(int,input().split()))
l.sort()

s=10*l[0]+l[1]
print(s+l[2])

# Fixed code:
l=list(map(int,input().split()))
l.sort(reverse=True)
 
s=10*l[0]+l[1]
print(s+l[2])
# Buggy code:
n = list(map(int, input().split()))
n.reverse()
print(n[0]*10 + n[1] + n[2])

# Fixed code:
n = list(map(int, input().split()))
n.sort()
print(n[2]*10 + n[1] + n[0])
# Buggy code:
a = list(map(int,input().split())
a.sort()
print(10*a[2]+a[1]+a[0])

# Fixed code:
inputs = list(map(int, input().split()))

inputs.sort()

print(inputs[0] + inputs[1] + inputs[2] * 10)
# Buggy code:

lst_A = input().split()

print(lst_A)

lst_A.sort()

ans = int(lst_A[2]) * 10 + int(lst_A[0]) + int(lst_A[1])

print(ans)

# Fixed code:

lst_A = input().split()

lst_A.sort()

ans = int(lst_A[2]) * 10 + int(lst_A[0]) + int(lst_A[1])

print(ans)
# Buggy code:
A = list(map(int, input().split()))
a = sorted(A)
k = str(A[-1])+str(A[1])
print(int(k)+A[0])


# Fixed code:
A = list(map(int, input().split()))
a = sorted(A)
k = str(a[-1])+str(a[1])
print(int(k)+a[0])
# Buggy code:
A,B,C=input().split()

a=int(A)
b=int(B)
c=int(C)

if a>=b:
  if a>=c:
    x=a
    if b>=c:
      y=b
      z=c
      else:
        y=c
        z=b
    else:
      x=c
      y=a
      z=b
else:
  if b>=c:
    x=b
    if a>=c:
      y=a
      z=c
      else:
        y=c
        z=a
    else:
      x=c
      y=b
      z=a

n==x*100+y*10+z
print(n)

# Fixed code:
A,B,C=input().split()

a=int(A)
b=int(B)
c=int(C)

if a>=b:
  if a>=c:
    x=a
    if b>=c:
      y=b
      z=c
    else:
        y=c
        z=b
  else:
      x=c
      y=a
      z=b
else:
  if b>=c:
    x=b
    if a>=c:
      y=a
      z=c
    else:
        y=c
        z=a
  else:
      x=c
      y=b
      z=a

n=x*10+y+z
print(n)
# Buggy code:
L=sorted(list(map(int, input().split())))
print(L[2]*L[1]+L[0])

# Fixed code:
L=sorted(list(map(int, input().split())))
print(int(str(L[2])+str(L[1]))+L[0])
# Buggy code:
a, b, c = map(int, input().split())
[a, b, c] = sorted([a, b, c])
print(10 * a + b + c)

# Fixed code:
a, b, c = map(int, input().split())
[a, b, c] = sorted([a, b, c], reverse=True)
print(10 * a + b + c)
# Buggy code:
A,B,C = list(map(int,input()))
if A >= B and B >= C:
  print(A*10 + B+C)
elif B >= C and C >=A:
  print(B*10 + C+A)
elif C >= A and A >= B:
  print(C*10 + A+B)

# Fixed code:
A,B,C = list(map(int,input().split()))
if A >= B and B >= C:
  print(A*10 + B+C)
elif B >= C and C >=A:
  print(B*10 + C+A)
elif C >= A and A >= B:
  print(C*10 + A+B)
elif A >= B and C >= B:
  print(A*10 + B+C)
elif B >= A and A >= C:
  print(B*10 + A+C)
elif C >= A and B >= A:
  print(C*10 + A+B)
# Buggy code:

A, B, C = [int(i) for i in input().split(' ')]

print(max(A + B*10 + C, A*10 + B + C))


# Fixed code:

A, B, C = [int(i) for i in input().split(' ')]

print(max(A + B*10 + C, A*10 + B + C, C*10 + A + B))
# Buggy code:
d = input().split()

a = int(d[0])
b = int(d[1])
c = int(d[2])

int e = 0

e = a*10+b+c

if e < b*10+a+c:
    e = b*10+a+c
    if e < c*10+a+b:
        e = c*10+a+b

if e < c*10+a+b:
    e= c*10+a+b
    if e < b*10+a+c:
        e = b*10+a+c

print(e)


# Fixed code:
d = input().split()

a = int(d[0])
b = int(d[1])
c = int(d[2])

e = 0

e = a*10+b+c

if e < b*10+a+c:
    e = b*10+a+c
    if e < c*10+a+b:
        e = c*10+a+b

if e < c*10+a+b:
    e= c*10+a+b
    if e < b*10+a+c:
        e = b*10+a+c

print(e)
# Buggy code:
a,b,c = map(int,input().split())
print(max(10*a+b+c,a+10*b+c,a+10*b+c))


# Fixed code:
a,b,c = map(int,input().split())
print(max(10*a+b+c,a+10*b+c,a+b+10*c))
# Buggy code:
N = list(map(int, input().split()))
N.sort(reverse=True)
print(N)
print(N[0]*10 + N[1] + N[2])


# Fixed code:
N = list(map(int, input().split()))
N.sort(reverse=True)
print(N[0]*10 + N[1] + N[2])
# Buggy code:
a, b, c = sorted(map(int, input().split()))
print(10*a+b+c)

# Fixed code:
a, b, c = sorted(map(int, input().split()))
print(c*10+a+b)
# Buggy code:
a = list(int,input().split())
a.sort()
print(10*a[2]+a[1]+a[0])

# Fixed code:
a = list(map(int,input().split()))
a.sort()
print(10*a[2]+a[1]+a[0])
# Buggy code:
a,b,c=map(int,input().split());print(max(a,b,c)*9+a,b,c)

# Fixed code:
a,b,c=map(int,input().split());print(max(a,b,c)*9+a+b+c)
# Buggy code:
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
print(l)
a = []
a.append(l[2])
c = int(str(l[0]) + str(l[1]))
a.append(c)
print(sum(a))

# Fixed code:
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
a = []
a.append(l[2])
c = int(str(l[0]) + str(l[1]))
a.append(c)
print(sum(a))
# Buggy code:
l = sorted(ist(map(int, input().split())))
print(l[0] + int(str(l[1]) + str(l[2])))

# Fixed code:
l = sorted(list(map(int, input().split())))
print(l[0] + int(str(l[2]) + str(l[1])))
# Buggy code:
a,b,c=map(int,input().split())

if a>=b and a>=c:
    print(10*a+b+c)
    
elif b>=a and b>=c:
    prnt(a+10*b+c)
    
elif c>=a and c>=b:
    print(a+b+10*c)

# Fixed code:
a,b,c=map(int,input().split())
if a>=b and a>=c:
    print(a*10+b+c)
elif b>=a and b>=c:
    print(b*10+a+c)
elif c>=a and c>=b:
    print(c*10+a+b)
# Buggy code:
N = list(map(int, input().split()))

print(int(str(N[2]) + str(N[1])) + N[0])

# Fixed code:
N = list(map(int, input().split()))
N.sort()

print(int(str(N[2]) + str(N[1])) + N[0])
# Buggy code:
a = list(map(int, input().split()))
a.sort()

print(a[0]*10+a[1]+a[2])

# Fixed code:
ABC = list(map(int,input().split()))
ABC.sort()
print(ABC[0]+ABC[1]+ABC[2]*10)
# Buggy code:
x = sorted(int(a) for a in input().split(' '))
print(x[0] * 10 + x[1] + x[2])

# Fixed code:
x = [int(a) for a in input().split(' ')]
x = sorted(x)
print(x[0] + x[1] + x[2] * 10)
# Buggy code:
*A,_= map(int, input().split())

A.sort(reverse=True)

print(A[0]*10+A[1]+A[2])

# Fixed code:
*A,= map(int, input().split())

A.sort(reverse=True)

print(A[0]*10+A[1]+A[2])
# Buggy code:
a,b,c=map(int,input().split())
print(max(10*a+b+c,a+10*b+c))

# Fixed code:
a,b,c=map(int,input().split())
print(max(10*a+b+c,a+10*b+c,a+b+10*c))
# Buggy code:
a,b,c = map(int,input().split())
print(max(a * 10 + b + c,a + b * 10 + c))

# Fixed code:
a,b,c = map(int,input().split())
print(max(a,b,c)*10+a + b + c -max(a,b,c))
# Buggy code:
a, b, c = map(int,input().split())
print(max(a*10+b+c, a+b*10+c))

# Fixed code:
a, b, c = map(int,input().split())
print(max(a*10+b+c, a+b*10+c, a+b+c*10))
# Buggy code:
a,b=map(int,input().split())
if a%2==1 and b%2==1:
    print("Yes")
else:
    print("NO")

# Fixed code:
a, b = map(int, input().split())
if a % 2 == 1 and b % 2 == 1 :
    print("Yes")
else :
    print("No")
# Buggy code:
A, B = map(int, input()split())
if (A * B) % 2 == 1:
  print("Yes")
else:
  print("No")

# Fixed code:
A,B = map(int, input().split())

if A*B % 2 == 1:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b=map(int,input().split())
if a*b%2==0:
  print("Yes")
else:
  print("No")

# Fixed code:
(a, b) = map(int, input().split(" "))

if (a * b) % 2 == 1:
    print("Yes")
else:
    print("No")