program hotrotinhoc;
var i,n,d: integer;
a: array[1..32000] of integer;
function nt(x: integer): boolean;
var j: integer;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while (j<=trunc(sqrt(x))) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
begin
readln(n);
d:=0;
for I:=1 to n do
begin
randomize;
a[i]:=random(2019);
end;
for i:=1 to n do
if a[i]=19 then inc(d);
writeln('Trong day co ',d,' so 19');
write('Cac so la boi cua 19 :');
for i:=1 to n do if a[i] mod 19=0 then write(a[i],' ');
writeln;
write('Cac so cung loai voi 19 la :');
for i:=1 to n do if nt(a[i]) then write(a[i],' ');
readln
end.