function f(x:longint):boolean;
var i,k:longint;
begin
for i:=1 to x div 2 do
if x mod i=0 then k+=i;
if k=x then f:=true else f:=false
end;
var i,n,k,ans:longint;
read(n);
for i:=1 to n do
read(k);
if f(k) then ans+=1
write(ans)
end.
function f(x:longint):boolean;
var i,k:longint;
begin
for i:=1 to x div 2 do
if x mod i=0 then k+=i;
if k=x then f:=true else f:=false
end;
var i,n,k,ans:longint;
begin
read(n);
for i:=1 to n do
begin
read(k);
if f(k) then ans+=1
end;
write(ans)
end.