#C618. Prime Number Filtering

    ID: 49911 Type: Default 1000ms 256MiB

Prime Number Filtering

Prime Number Filtering

Given a list of integers, your task is to filter out and print only the prime numbers. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. In mathematical terms, a number (p) is prime if and only if (p > 1) and it has no divisors other than 1 and (p).

inputFormat

The input is read from stdin. The first line contains an integer (n) representing the number of integers in the list. The second line contains (n) space-separated integers.

outputFormat

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

6
2 4 7 10 13 16
2 7 13