import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException{
StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
in.nextToken();int N=(int) in.nval;
Integer[]arr=new Integer[N];
for(int i=0;i<N;i++) {
in.nextToken();arr[i]=(int) in.nval;
}
Comparator<Integer> comp=new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
int num1=Integer.valueOf(String.valueOf(o1)+String.valueOf(o2));
int num2=Integer.valueOf(String.valueOf(o2)+String.valueOf(o1));
if(num1>num2) {
return -1;
}else{
return 1;
}
}
};
Arrays.sort(arr,comp);
String ans="";
for(int a:arr) {
ans+=String.valueOf(a);
}
out.print(ans);
out.flush();
out.close();
}
}
|