659. Sorted Squares

0

Easy

You have a strong affinity for finding the squares of numbers. Your goal is to sort an array of integers by finding the squares of each number.
Given an integer array nums sorted in non-decreasing order, output an array of the squares of each number, sorted in non-decreasing order.

Input Format

The first line contains an integer N (the size of the array).
The second line contains the integer array.

Output Format

Print the array of squared and sorted numbers.

Example

Input

5
-3 -2 0 1 4

Output

0 1 4 9 16

Constraints

1 <= N <= 10^4
-10^4 <= Nums[i] <= 10^4

Loading...

View Submissions

Console