#C14912. Filter Prime Numbers

    ID: 44614 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

You are given a list of n integers. Your task is to filter out and output only the prime numbers from the list. A prime number is an integer \( n \) such that \( n > 1 \) and it has no divisors other than 1 and itself, i.e. there exists no integer \( d \) with \( 2 \le d \le \sqrt{n} \) that divides \( n \) evenly.

Read the input, determine which numbers are prime, and then print those numbers in the same order as they appear in the input, separated by a single space. If there are no prime numbers, output an empty line.

inputFormat

The first line contains an integer \( n \) (where \( n \ge 0 \)) representing the number of elements in the list. If \( n > 0 \), the second line contains \( n \) space-separated integers.

outputFormat

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

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