program bing;
const
max=10000;
var
f1,f2:text;
k:integer;
a:array[1..10000] of integer;
procedure pre;
var
i,j:integer;
f:boolean;
begin
a[1]:=2;
k:=1;
for i:=3 to max do
begin
f:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then
begin
f:=false;
break;
end;
if f then begin
inc(k);
a[k]:=i;
end;
end;
end;
procedure init;
begin
assign(f1,'conprime.in.in');reset(f1);
assign(f2,'conprime.in.out');rewrite(F2);
pre;
end;
procedure nb;
var
i,j,n,s,x:integer;
begin
while not eof(f1) do
begin
s:=0;
readln(f1,n);
if n=0 then exit;
i:=0;
repeat
inc(i);
j:=i;
x:=0;
repeat
x:=x+a[j];
inc(j);
until x>=n;
if x=n then inc(s);
until a[i]>=n;
writeln(F2,s);
end;
end;
begin
init;
nb;
close(f1);close(f2);
end.