Sona's Prime

2.5

16 votes
Easy
Problem

Sona loves numbers. Sona loves only certain type of numbers especially prime numbers. She devised a new definition for prime numbers. In a given set of positive integer X = {X0,X1,....Xn-1} Xi is prime only if there are no elements in X which are divisors of Xi (except Xi itself).

You are given the set X and find the elements which are prime for this set.

Input format

The first line contains an integer 'N' which denotes the size of the set and the next line contains N spaced integers which represents the elements of the set.

Output format

Print the elements which are prime for this set X

Constraints

1<=N < = 100

1< = X[i] < = 10^6

Sample Input
5
10 49 5 3 20
Sample Output
49 5 3
Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?