import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author User
 */
public class Polica {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        
        Scanner in =new Scanner(System.in);
        int n=in.nextInt();
        int a[]=new int[n];
        int m=0;
        int g=10;
        int x;
        int h=0;
        int y=-1;
        int c=0;
        int j= n-1;
        int w=0;
        int q[]=new int[n];
        
        
        for (int i=0;i<n;i++){
            a[i]=in.nextInt();
            q[i]=a[i];
        }
         
        for(int i=n-1;i>=1;i--){
            m=m+i;
        }
        
        int p[]= new int[m];

        for(int s=0;s<m;s++){
           g=10;
           g=(int) Math.pow(g,j);
        
            w=w+1;
           y=y+1;
           c=c+1;
           h=0;
          
                    for(int i=0;i<n;i++){
                        p[s]=a[i]*g+h;
                        g=g/10;
                        h=p[s];
                    
                    }
                  
                    if(w!=3){
                        for (int i=0;i<n;i++){
                            a[i]=q[i];
                        }  
                        
                      x = a[y];
                      a[y]=a[c];
                      a[c]=x;
                     
                    }     
        }
        h=0;
        g=10;
        j=n-1;
        g=(int) Math.pow(g,j);
      Arrays.sort(p);
        int gg[]=new int [m];
        
        for(int i =0;i<m;i++){
            gg[i]=(p[m-1]-h)/g;
            h=gg[i]*g+h;
            g=g/10;
            System.out.print(gg[i]+" ");
        }
       
    }
    
}