public class InsertionSortA extends MiniJava {
    public static int[] readArray(int number) {
        // number = Anzahl zu lesender Elemente
        int[] result = new int[number]; // Feld anlegen
        for (int i = 0; i < number; ++i) {
            result[i] = read();
        }
        return result;
    }

    public static int locate(int[] b, int x, int i) {
        int j = 0;
        while (j < i && x > b[j]) ++j;
        return j;
    }
    public static void shift(int[] b, int j, int i) {
        for (int k = i-1; k >= j; --k)
            b[k+1] = b[k];
    }

    public static void insert(int[] b, int x, int i) {
        // finde Einfuegestelle j fuer x in b
        int j = locate(b,x,i); 
        // verschiebe in b Elemente b[j],...,b[i-1]
        // nach rechts
        shift(b,j,i); 
        b[j] = x;
    }
    
    public static int[] sort(int[] a) {
        int n = a.length;
        int[] b = new int[n];
        for (int i = 0; i < n; ++i)
            insert(b, a[i], i); 
                // b    = Feld, in das eingefuegt wird
                // a[i] = einzufuegendes Element
                // i    = Anzahl von Elementen in b
        return b;
    } // end of sort()

    public static String arrayToString(int[] a) {
        if (a.length == 0) return "[]";
        String res = "[" + a[0];
        for (int i=1; i<a.length; ++i) {
            res += ", " + a[i];
        }
        res += "]";
        return res;
    }
    
    // Jetzt kommt das Hauptprogramm
    public static void main(String[] args) {
        int n = read();
        int[] a = readArray(n);
        a = sort(a);
        write(arrayToString(a));
    } // end of main()    
}
