#include <bits/stdc++.h>

using namespace std;

ifstream fi ("dqnt.inp");
ofstream fo ("dqnt.out");

int ktnt(int n, int i){
  if (n<2){return 0;}
  else if (i==1){return 1;}
  else if (n%i==0){return 0;}
  else {ktnt(n,i-1);}
}

int main(){
 int n;
 fi>>n;
 int a[n],i,b[n],k=0;
 for (i=0;i<n;i++){
    fi>>a[i];
    if (ktnt(a[i],sqrt(a[i]))==1){b[k]=a[i];k++;}
 }
 if (k==0){fo<<-1;}
 else {
 sort(b,b+k);
 for (i=0;i<k;i++){fo<<b[i]<<" ";}
 }
}
