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=1;i<=n-1;i++){
            m=m+i;
        }
        m=m+1;
        
        int p[]= new int[m];
        if(n>2){
        for(int s=0;s<m;s++){  
            
             for (int i=0;i<n;i++){
                a[i]=q[i];
             }  
            w=w+1;
            y=y+1;
             
            if((w>m-1) ||(y>=n)){
              c=c+1;
              y=c+1;
            } 
            
                
                      x = a[c];
                      a[c]=a[y];
                      a[y]=x;
                      
           g=10;
           g=(int) Math.pow(g,j);
        
           h=0;
          
                    for(int i=0;i<n;i++){
                        p[s]=a[i]*g+h;
                        g=g/10;
                        h=p[s];
                    //  System.out.println(" "+p[s]);
                    }    
        }
        
         w=0;
        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-1;i++){
            w=w+1;
            if(w==n+1)
            break;
            gg[i]=(p[m-1]-h)/g;
            h=gg[i]*g+h;
            g=g/10;
            System.out.print(gg[i]+" ");
        }
    }
        else{
            y=0;
            c=1;
          x = a[c];
          a[c]=a[y];
          a[y]=x;
           for(int i =0;i<n;i++){
          System.out.print(a[i]+" ");
                  }
                      
        }
      
    }
    
}