uses crt;
var a:array[1..1000000] of longint;
i,n,max:longint;
function nt(n:longint):boolean;
var i:longint;
begin
if n<2 then exit(false);
for i:=2 to trunc(sqrt(n)) do
if n mod i = 0 then
exit(false);
exit(true);
end;
function tong_cp(i:longint):longint;
begin
if i=0 then exit(0);
if a[i]=sqr(trunc(sqrt(a[i]))) then exit(tong_cp(i-1)+a[i]);
exit(tong_cp(i-1));
end;
function phantuln(i:longint):longint;
begin
if i=0 then exit(0);
if a[i]=max then exit(phantuln(i-1)+1);
exit(phantuln(i-1));
end;
function tongle(i:longint):longint;
begin
if i=0 then exit(0);
if a[i] mod 2 = 1 then exit(tongle(i-1)+a[i]);
exit(tongle(i-1));
end;
function chandautien(i:longint):longint;
begin
if i=n+1 then exit(0);
if a[i] mod 2=0 then exit(a[i]);
exit(chandautien(i+1));
end;
function ledautien(i:longint):longint;
begin
if i=n+1 then exit(0);
if a[i] mod 2=1 then exit(a[i]);
exit(ledautien(i+1));
end;
function ntdautien(i:longint):longint;
begin
if i=n+1 then exit(0);
if nt(a[i])=true then exit(a[i]);
exit(ntdautien(i+1));
end;
begin
clrscr;
readln(n);
read(a[1]);
max:=a[1];
for i:=2 to n do
begin
read(a[i]);
if max<a[i] then max:=a[i];
end;
readln;
writeln(tong_cp(n));
writeln(phantuln(n));
writeln(tongle(n));
writeln(chandautien(1));
writeln(ledautien(1));
writeln(ntdautien(1));
readln;
end.