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

namespace Polica
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split();
            int[] a = new int[N];
            int[] b = new int[N];
            for (int i = 0; i < N; i++)
            {
                a[i] = int.Parse(str[i]);
                b[i] = int.Parse(str[i]);
            }
            bool p = true;
            Array.Sort(b);
            Array.Reverse(b);
            if (N == 2) Console.WriteLine(a[1] + " " + a[0]);
            else
            {
                int i = 0;
                while(p)
                {
                    if (a[i] == b[i]) i++;
                    else
                    {
                        for (int j = i; j < N; j++)
                        {
                            if(a[j]==b[i])
                            {
                                int pom = a[i];
                                a[i] = a[j];
                                a[j] = pom;
                                break;
                            }
                        }
                        p = false;

                    }
                }
                for (int k = 0; i < N; i++)
                {
                    Console.Write(a[k] + " ");
                }
                Console.WriteLine();
            }
            
        }
    }
}