#C13185. Filter Prime Numbers

    ID: 42695 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

You are given a list of integers. Your task is to filter out and print only the prime numbers from the list. A number is considered prime if it is greater than 1 and has no positive divisors other than 1 and itself. In mathematical terms, a number \(p\) is prime if \(p > 1\) and for every integer \(d\) such that \(2 \le d \le \sqrt{p}\), \(d\) does not divide \(p\).

The input will be provided from the standard input (stdin) and the output should be written to the standard output (stdout). If none of the numbers is prime, print an empty line.

inputFormat

The first line of input contains an integer \(n\) which represents the number of elements in the list. The second line contains \(n\) space-separated integers.

outputFormat

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

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