#K35842. Arrange Flowers

    ID: 25621 Type: Default 1000ms 256MiB

Arrange Flowers

Arrange Flowers

You are given a set of flowers, each having an attractiveness value. The task is to arrange the flowers such that the absolute difference between any two adjacent flowers is minimized. In other words, if the arranged sequence is \(a_1, a_2, \dots, a_n\), you should minimize \(|a_i - a_{i+1}|\) for every valid \(i\). The simplest way to achieve this is by sorting the list.

inputFormat

The input is provided via standard input and consists of two lines:

  1. The first line contains an integer \(n\) that denotes the number of flowers.
  2. The second line contains \(n\) space-separated integers, where each integer represents the attractiveness of a flower.

outputFormat

Output a single line to standard output containing the arranged sequence of attractiveness values separated by a single space.

## sample
5
-2 4 1 0 -5
-5 -2 0 1 4

</p>