시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 120 39 28 37.333%

문제

서로 다른 자연수 n개 a1, a2, ..., an이 주어진다. 이 때, a1, ... an에서 2개를 선택해서 붙여서 새로운 수를 만들 수 있다. 이 때, 가장 세 번째로 작은 수를 구하는 프로그램을 작성하시오.

예를 들어, 3과 4를 합치면 34나 43이 된다. 또, a1 = 1, a4 = 11을 합쳐서 111을 만든 경우에, a1a4와 a4a1은 다른 수이다.

입력

첫째 줄에 수의 개수 n(3 ≤ n ≤ 108)이 주어진다. 다음 줄부터 한 줄에 하나씩 ai가 주어진다. (1 ≤ ai ≤ 10000)

출력

세 번째로 작은 수를 출력한다.

예제 입력 1

3
2
7
5

예제 출력 1

52
W3sicHJvYmxlbV9pZCI6IjU2MTkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWMxMzggXHViYzg4XHVjOWY4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWMxMWNcdWI4NWMgXHViMmU0XHViOTc4IFx1Yzc5MFx1YzVmMFx1YzIxOCBuXHVhYzFjIGE8c3ViPjE8XC9zdWI+LCBhPHN1Yj4yPFwvc3ViPiwgLi4uLCBhPHN1Yj5uPFwvc3ViPlx1Yzc3NCBcdWM4ZmNcdWM1YjRcdWM5YzRcdWIyZTQuIFx1Yzc3NCBcdWI1NGMsIGE8c3ViPjE8XC9zdWI+LCAuLi4gYTxzdWI+bjxcL3N1Yj5cdWM1ZDBcdWMxMWMgMlx1YWMxY1x1Yjk3YyBcdWMxMjBcdWQwZGRcdWQ1NzRcdWMxMWMgXHViZDk5XHVjNWVjXHVjMTFjIFx1YzBjOFx1Yjg1Y1x1YzZiNCBcdWMyMThcdWI5N2MgXHViOWNjXHViNGU0IFx1YzIxOCBcdWM3ODhcdWIyZTQuIFx1Yzc3NCBcdWI1NGMsIFx1YWMwMFx1YzdhNSBcdWMxMzggXHViYzg4XHVjOWY4XHViODVjIFx1Yzc5MVx1Yzc0MCBcdWMyM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