#C14588. Filter Prime Numbers

    ID: 44253 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

You are given a list of integers. Your task is to filter this list and output only the prime numbers in the same order they appear in the input.

A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. In other words, a number \( p \) is prime if and only if \( p > 1 \) and it is not divisible by any integer \( d \) with \( 2 \le d \le \sqrt{p} \).

The input is provided from standard input (stdin) and the output should be written to standard output (stdout).

inputFormat

The first line contains an integer \( n \) representing the number of elements in the list.

The second line contains \( n \) space-separated integers.

outputFormat

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

## sample
5
2 3 5 7 11
2 3 5 7 11