uses crt;
var i,n,vt,dnt,s,x,lp,j,t:longint; a:array[1..1000000]of longint;
function nt(a:longint):boolean;
var i:longint;
begin
i:=2;
while(a>1)and(a mod i<>0)do inc(i);
nt:=i=a;
end;
begin
clrscr;
write('Nhap N (N<=50): ');readln(n);
write('Nhap X: ');readln(x);
for i:=1 to n do
begin
write('A[',i,']= ');readln(a[i]);
inc(s,a[i]);
if x=a[i] then vt:=i;
if a[i] mod 2=0 then lp:=lp*a[i]*a[i]*a[i];
if nt(a[i]) then inc(dnt);
for j:=1 to i-1 do
if a[i]>a[j] then
begin t:=a[i]; a[i]:=a[j]; a[j]:=t; end;
end;
writeln('a) Tong: ',s);
if dnt=0 then writeln('b) X khong co trong mang') else
writeln('b) Vi tri cua x: ',vt);
writeln('c) Tich lap phuong cua ca phan tu chan: ',lp);
writeln('d) Mang da sap xep: ');
for i:=1 to n do write(a[i],' '); writeln;
writeln('e) Mang co ',dnt,' so nguyen to');
readln
end.