using System;

namespace Polica
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] niz = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(niz[i]);
            }
            int max = a[0];
            int p;
            for(int i = 1; i < n; i++)
            {
                int raz = max - a[i];
                if (n == 2)
                {
                    p = a[0];
                    a[0] = a[1];
                    a[1] = p;
                }
                else if (a[i] > max)
                {
                    max = a[i];
                    p = a[0];
                    if (max != a[0])
                    {
                        a[0] = max;
                        a[i] = p;
                    }
                }
                else if(a[0] == max)
                {
                    for(int j = 0; j < n; j++)
                    {
                        if(max - a[j] < raz && raz != 0)
                        {
                            max = a[j];
                            a[j] = a[i];
                            a[i] = max;
                        }
                    }
                }
            }
            for (int i = 0; i < n; i++)
                Console.Write(a[i] + " ");
        }
    }
}