//Solutia ta era partial ok,
//Ai avut mici erori precum
//"ampersant"-ul trebuia
//pus inaintea lui k.
//Solutia mea:
#include <iostream>
using namespace std;
void numar(unsigned int n, int a[], int &k)
{
int max,min,i2=1,x;
max=a[0];
min=a[0];
for(int i=0;i<n;i++)
{
if(max<a[i])
max=a[i];
}
for(int i=0;i<n;i++)
{
if(min>a[i])
min=a[i];
}
x=min;
while(x!=0)
{
i2*=10;
x/=10;
}
k=max*i2+min;
}
int main()
{
unsigned int n;
int a[100],k;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
numar(n,a,k);
cout<<k;
}