program setb(input,output);
var
i,j,k,a,b,p,st,en:longint;
pp:array[0..10000]of longint;
num:array[1..1000000]of longint;
boo:array[1..2000000]of boolean;
procedure makeprime;
var
i:integer;
boo:boolean;
begin
pp[0]:=1;
pp[1]:=2;
i:=3;
repeat
boo:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then
begin
boo:=false;
break;
end;
if boo then
begin
inc(pp[0]);
pp[pp[0]]:=i;
if (i>=p)and(st=0) then
st:=pp[0];
if i>b then
begin
en:=pp[0]-1;
exit;
end;
end;
inc(i,2);
until 0=1;
end;
begin
assign(input,'setb.in');
reset(input);
assign(output,'setb.out');
rewrite(output);
readln(a,b,p);
makeprime;
for i:=a to b do
num[i]:=i;
for i:=st to en do
for j:=a to b do
if j mod pp[i]=0 then
begin
if num[j]<>j then
for k:=a to b do
if (num[j]=num[k])and(k<>j) then
num[k]:=1000000+i;
num[j]:=1000000+i;
end;
st:=0;
for i:=a to b do
if not(boo[num[i]]) then
begin
boo[num[i]]:=true;
inc(st);
end;
writeln(st);
close(input);
close(output);
end.