#include <bits/stdc++.h>
using namespace std;
bool zhishu(int n){
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
int main(){
int n;
cin>>n;
int a[n+5];
for(int i=1;i<=n;i++){
cin>>a[i];
if(zhishu(a[i])==true){
cout<<a[i]<<" ";
}
}
cout<<endl;
return 0;
}