#include <iostream>
#include <cmath>
using namespace std;
int main(){
int i,j,n,prime[100],x,nr=0;
cout<<"Introduceti nr de elemente: ";
cin>>n;
cout<<"Introduceti termenii sirului: \n";
for(i=0;i<n;i++){
cin>>x;
j=2;
while(j<=(int)sqrt(x)+1){
if(x%j==0){
break;
}
j++;
}
if(j==(int)sqrt(x)+2){
prime[nr]=x;
nr++;
}
}
if(nr==0){
cout<<"NU";
}
for(i=0;i<nr;i++){
cout<<prime[i]<<" ";
}
return 0;
}