#include <iostream>
using namespace std;
int main() {
int n, max = 0, min = 2147483647;
cin >> n;
for(int i = 0; i < n; i++) {
int m;
cin >> m;
if(m > max)
max = m;
if(m < min)
min = m;
}
int p = 10;
while(p < min)
p = p * 10;
cout << max * p + min;
return 0;
}