#include <fstream>
#include <cmath>
#include <algorithm>
using namespace std;
ifstream f1("dqnt.inp");
ofstream f2("dqnt.out");
long n,a[10000];
bool nt(long i,long j)
{
    if (i < 2) return false;
    else if (j == 1) return true;
    else if (i%j == 0) return false;
    else nt(i,j-1);
}
int main()
{
    long tg = 0;
    f1 >> n;
    for (long i = 0; i < n; i++) f1 >> a[i];
    sort(a,a+n);
    for (long i = 0; i < n; i++) if(nt(a[i],sqrt(a[i])) == 1){f2 << a[i] << " ";tg = 1;}
    return 0;
}
