const fi='SNT.INP';
fo='SNT.OUT';
var n:qword;
f1,f2:text;
function nt(n:longword):boolean;
var i:longword;
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 snt(n:longword):byte;
var i:longword;
begin
while n<>0 do
begin
if nt(n)=false then exit(0);
n:=n div 10;
end;
exit(1);
end;
begin
assign(f1,fi);reset(f1);
assign(f2,fo);rewrite(f2);
readln(f1,n);
writeln(f2,snt(n));
close(f1);close(f2);
end.