#C13487. Find Perfect Squares
Find Perfect Squares
Find Perfect Squares
You are given a list of integers. Your task is to identify and output all the integers from the list that are perfect squares.
A number is considered a perfect square if there exists an integer \(x\) such that \(x^2 = n\). For example, \(1=1^2\), \(4=2^2\), \(9=3^2\), etc.
The output should preserve the order in which the perfect squares appear in the input list. If there are no perfect squares in the input, output an empty line.
inputFormat
The input is given via standard input and consists of two lines:
- The first line contains a single integer \(N\), the number of integers in the list.
- The second line contains \(N\) space-separated integers.
outputFormat
Output via standard output a single line containing all the perfect square numbers found in the list, separated by spaces. If no perfect squares are found, output an empty line.
## sample6
10 4 5 16 23 1
4 16 1