Skip to main content
LIVE CONTEST: ALGOR Contest: Round #4 (Special Challenge) is live now!

~/algor $ cat problems/ikki-korsatkich-saralangan-kvadratlar

Sorted squares

Easy 1000 ms 128 MB 27%
Share

An array of $n$ integers sorted in non-decreasing order is given (the numbers may be negative). Compute the square of every element and print the squares in non-decreasing order.

A sorted array and its squares: the larger one is taken from the two ends, the result is filled from right to left

Input

The first line contains a positive integer $n$.
The second line contains $n$ integers $a_{i}$.

Output

One line with $n$ numbers separated by spaces.

Note

$1 \le n \le 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$
the array is in non-decreasing order

Examples

Input #1
5
-4 -1 0 3 10
Output #1
0 1 9 16 100
Input #2
1
-7
Output #2
49

Sign in to submit a solution

Signing up is free and takes a minute.