#C13369. Perfect Squares Extraction

    ID: 42899 Type: Default 1000ms 256MiB

Perfect Squares Extraction

Perfect Squares Extraction

You are given a list of integers. Your task is to extract and print the numbers from the list that are perfect squares. A number is a perfect square if it can be written in the form ( n^2 ), where ( n ) is a non-negative integer.

The input is given through standard input. The first line contains an integer ( N ) representing the number of integers in the list. The second line contains ( N ) space-separated integers. The output should be all the perfect squares from the list in the same order as they appear in the input, separated by a single space. If there are no perfect squares, print an empty line.

For example, if the input is:

5
1 3 4 10 16

The output should be:

1 4 16

inputFormat

Input is provided via standard input. The first line contains an integer ( N ) (the number of elements). The second line contains ( N ) space-separated integers.

outputFormat

Output all the perfect squares found in the list in the same order as input, separated by spaces. If no perfect squares exist, output an empty line.## sample

5
1 3 4 10 16
1 4 16