#C14247. Filter Prime Numbers

    ID: 43875 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

You are given a list of integers. Your task is to filter and output only the prime numbers from this list. A number \(n\) is considered prime if it is greater than 1 and has no positive divisors other than 1 and itself. In other words, for a number \(n > 1\), if there is no integer \(i\) with \(2 \le i \le \sqrt{n}\) such that \(n \bmod i = 0\), then \(n\) is prime.

If no prime numbers are found in the input, output an empty line.

Note: You must read from standard input and write to standard output.

inputFormat

The first line of input consists of an integer \(n\) representing the number of elements in the list. The second line contains \(n\) integers separated by spaces.

outputFormat

Output all the prime numbers from the input list, in the same order they appeared, separated by a space. If there are no prime numbers, output an empty line.

## sample
10
2 3 4 5 6 7 8 9 10 11
2 3 5 7 11