#C14391. Filter Prime Numbers

    ID: 44035 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

Given an array of integers, filter out and print only the prime numbers. A prime number is defined as a positive integer greater than 1 that has no divisors other than 1 and itself. In mathematical terms, a number \( p \) is prime if \( p > 1 \) and for every integer \( d \) with \( 1 < d < p \), it holds that \( p \mod d \neq 0 \).

If no prime numbers exist in the array, output an empty line.

inputFormat

The first line contains an integer \( n \), representing the number of elements in the array. The second line contains \( n \) space-separated integers.

outputFormat

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

## sample
0