using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace petlja2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] niz = new int[n];
            string[] x = Console.ReadLine().Split();
            bool breakic = false;
            for (int i = 0; i < n; i++)
                niz[i] = int.Parse(x[i]);
            if (n == 2)
            {
                int pom = niz[0];
                niz[0] = niz[1];
                niz[1] = pom;
            }
            else
                for (int i = 0; i < n; i++)
                {
                    if (niz[i] < 9)
                    {
                        int k = 9;
                        while (k > niz[i])
                        {
                            int l = trazi(niz, i+1, k);
                            if (l > -1)
                            {
                                int pom = niz[i];
                                niz[i] = niz[l];
                                niz[l] = pom;
                                breakic = true;
                                break;
                            }
                            k--;
                        }
                    }
                    if (breakic)
                        break;
                }
            for (int i = 0; i < n; i++)
            {
                Console.Write(niz[i] + " ");
            }
            Console.WriteLine();
        }

        static int trazi(int[] niz,int od, int trazeni)
        {
            for (int i = niz.Length - 1; i >= od; i--)
            {
                if (niz[i] == trazeni)
                    return i;
            }
            return -1;
        }
    }
}