n = gets.to_i a = gets.split.map(&:to_i) 1.upto(2 * n - 4) do |i| 0.upto([i, n - 1].min) do |x| y = i - x next if y < 0 || y >= n || x >= y if a[x] > a[y] tmp = a[y] a[y] = a[x] a[x] = tmp end end end puts a.join(' ')