#C2450. Sorted Squares Array

    ID: 45768 Type: Default 1000ms 256MiB

Sorted Squares Array

Sorted Squares Array

Given an array of integers, your task is to compute the square of each element and then sort the resulting squares in non-decreasing order.

For example, if the input array is [-4, -1, 0, 3, 10], then after squaring each element you get [16, 1, 0, 9, 100] and sorting them in ascending order produces [0, 1, 9, 16, 100].

The input will consist of a single integer \(n\) representing the number of elements, followed by \(n\) space-separated integers. The output should consist of the sorted squares printed in one line.

inputFormat

The first line of input contains an integer \(n\) (\(1 \le n \le 10^4\)), which denotes the number of elements in the array.

The second line contains \(n\) space-separated integers, where each integer \(x\) satisfies \(-10^4 \le x \le 10^4\).

outputFormat

Output a single line containing \(n\) space-separated integers representing the sorted squares of the input numbers.

## sample
5
-4 -1 0 3 10
0 1 9 16 100

</p>