#C14870. Filter Prime Numbers

    ID: 44567 Type: Default 1000ms 256MiB

Filter Prime Numbers

Filter Prime Numbers

You are given a list of integers. Your task is to filter out the prime numbers from the list, preserving their original order. A number is considered prime if it is greater than 1 and has no positive divisors other than 1 and itself. Use the following standard definition of a prime: \(n\) is prime if \(n > 1\) and for every integer \(d\) with \(2 \le d \le \sqrt{n}\), \(d\) does not divide \(n\).

If no prime numbers are found in the input, print -1.

inputFormat

The first line contains a single integer \(N\) representing the number of elements in the list. 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, print -1.

## sample
7
10 15 3 7 2 20 11
3 7 2 11