uses crt;
var n,i,d,t,x,kt:integer;
st:string;
a:array[1..255]of integer;
begin
clrscr;
write('n='); readln(n);
str(n,st);
d:=length(st);
writeln('Cac chu so cua ',n,' la: ');
for i:=1 to d do
write(st[i]:4);
writeln;
t:=0;
for i:=1 to d do
begin
val(st[i],a[i],x);
t:=t+a[i];
end;
writeln('Tong cac chu so cua ',n,' la: ',t);
if t>1 then
begin
kt:=0;
for i:=2 to t-1 do
if t mod i=0 then kt:=1;
if kt=0 then writeln('Tong cac chu so cua ',n,' la so nguyen to')
else writeln('Tong cac chu so cua ',n,' khong la so nguyen to');
end
else writeln('Tong cac chu so cua ',n,' khong la so nguyen to');
writeln('Cac so chinh phuong tu 1 den tong cac chu so cua ',n,' la: ');
for i:=1 to t do
if sqrt(i)=trunc(sqrt(i)) then write(i:4);
readln;
end.