program ex;
var
zu,z,k,i,j,a,b,n,x:longint;
pd:array[1..100000] of boolean;
f:array[1..1000,1..1000] of boolean;
ss:array[1..10000] of longint;
procedure init;
begin
assign(input,'setb.in');
assign(output,'setb.out');
reset(input);
rewrite(output);
readln(a,b,n);
close(input);
for i:=1 to 1000 do for j:=1 to 1000 do f[i,j]:=false;
for i:=1 to 100000 do pd[i]:=true;
end;
procedure sushu;
var
p:boolean;
i,j,m:longint;
begin
x:=3;
ss[1]:=2;ss[2]:=3;ss[3]:=5;
for i:=6 to 100000 do
begin
p:=true;
for j:=1 to trunc(sqrt(x)) do
begin
m:=i mod ss[j];
if (m=0) then p:=false;
end;
if (p=true) then
begin
inc(x);
ss[x]:=i;
end;
end;
end;
procedure ty(r:longint);
var
c:longint;
begin
pd[r]:=false;
for c:=a to b do
begin
if (f[r,c])and(pd[c]) then
ty(c);
end;
end;
begin
init;
sushu;
i:=1;
while ss[i]<n do
begin
inc(i);
end;
k:=i;
for i:=a to b do
begin
for j:=a to b do
begin
z:=k;
while (ss[z]<i)and(i<>j)and(ss[z]<j) do
begin
if (i mod ss[z]=0)and(j mod ss[z]=0) then
f[i,j]:=true;
inc(z);
end;
end;
end;
zu:=0;
for i:=a to b do
begin
if pd[i] then
begin
ty(i);
inc(zu);
end;
end;
writeln(zu);
close(output);
end.