#K51792. Modify and Sort Array

    ID: 29166 Type: Default 1000ms 256MiB

Modify and Sort Array

Modify and Sort Array

You are given an array of integers. Your task is to process the array by performing the following steps:

  1. Remove all negative numbers.
  2. Square each of the remaining numbers. That is, for each number \(x\) such that \(x \ge 0\), compute \(x^2\).
  3. Sort the resulting numbers in non-decreasing order.

The input will be read from standard input (stdin) and the output must be printed to standard output (stdout). Ensure that you follow the input and output format precisely.

Example:

Input:
7
-3 -1 0 2 4 -2 3

Output: 0 4 9 16

</p>

inputFormat

The input consists of two lines:

  • The first line contains a single integer \(n\) denoting the number of elements in the array.
  • The second line contains \(n\) space-separated integers.

outputFormat

Output the modified array after performing the operations. The numbers must be printed in a single line separated by a single space.

If the resulting array is empty, output an empty line.

## sample
7
-3 -1 0 2 4 -2 3
0 4 9 16