Program HOC24;
var d,i,n: integer;
a: array[1..1000] of integer;
t: longint;
function nt(x: longint): boolean;
var j: longint;
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
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
d:=0; t:=0;
for i:=1 to n do
if nt(a[i]) then
begin
d:=d+1;
t:=t+a[i];
end;
writeln('Co ',d,' so nguyen to trong day');
write('Tong cac so nguyen to trong day la: ',t);
readln
end.
uses crt;
var a:array[1..1000]of integer;
i,n,dem,t,j,kt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then
begin
inc(dem);
t:=t+a[i];
end;
end;
writeln('So luong so nguyen to la: ',dem);
writeln('Tong cac so nguyen to la: ',t);
readln;
end.