var
i,j,count,sp,s:integer;
begin
count:=0;
for i:=2 to 1000 do
s:=i; sp:=0;
while s>0 do
sp:=sp + s mod 10;
s:=s div 10;
end;
if sp>=2 then
s:=1; j:=2;
while (sqr(j)<=sp) and (s=1) do
if sp mod j = 0 then
s:=0
else inc(j);
if s=1 then
inc(count);
writeln(count);
end.
var
i,j,count,sp,s:integer;
begin
count:=0;
for i:=2 to 1000 do
begin
s:=i; sp:=0;
while s>0 do
begin
sp:=sp + s mod 10;
s:=s div 10;
end;
if sp>=2 then
begin
s:=1; j:=2;
while (sqr(j)<=sp) and (s=1) do
if sp mod j = 0 then
s:=0
else inc(j);
if s=1 then
inc(count);
end;
end;
writeln(count);
end.