program prisonbreak;
var
dp,a,b:array [0..10001] of longint;
n,i:longint;
procedure get(num,o:longint);
var oil,i:longint;
begin
if num<>0 then begin
i:=num;o:=o+b[num];
repeat
i:=i-1;oil:=o-(a[num]-a[i]);
if oil>=0 then begin
get(i,oil);
if dp[num]>dp[i] then dp[num]:=dp[i]+1;
end;
until (i=0) or (oil<0);
end;
end;
begin
assign (input,'prisonbreak.in');
reset (input);
readln (n);
fillchar (a,sizeof(a),0);
fillchar (b,sizeof(b),0);
for i:=1 to n+1 do readln (a[i],b[i]);
close (input);
assign (output,'prisonbreak.out');
rewrite (output);
for i:=0 to n+1 do dp[i]:=maxlongint;
dp[0]:=0;
get(n+1,0);
writeln (dp[n+1]-1);
close (output);
end.