using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); for (int i = 1; i < 2 * n - 3; i++) swapPQ(a, i); Console.WriteLine(string.Join(" ",a)); } public static void swapPQ (int[] a, int b) { var n = a.Length; for (int p = 0; p < n-1; p++) { var q = b - p; if (q > p && q <= n - 1 && a[p] > a[q]) swap(a, p, q); } } public static void swap (int[] a , int i , int j) { var t = a[i]; a[i] = a[j]; a[j] = t; } }