uses crt;
var a,b,c:array[1..100]of integer;
i,n,dem,dem1,kt,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
for i:=1 to n do
if sqrt(a[i])=trunc(sqrt(a[i])) then
begin
inc(dem);
b[dem]:=a[i];
end;
dem1:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to trunc(sqrt(a[i])) do
if a[i] mod j=0 then kt:=1;
if kt=0 then
begin
inc(dem1);
c[dem1]:=a[i];
end;
end;
if dem=0 then writeln('Trong day khong co so chinh phuong')
else begin
writeln('Cac so chinh phuong trong day la: ');
for i:=1 to dem do
write(b[i]:4);
end;
if dem1=0 then writeln('Trong day khong co so nguyen to')
else begin
writeln('Cac so nguyen to trong day la: ');
for i:=1 to dem1 do
write(c[i]:4);
end;
readln;
end.