A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.Let us remind you that a ring is a region located between two concentric circles with radii r and R (r < R). These radii are called internal and external, respectively. Concentric circles are circles with centers located at the same point.Soon a white canvas, which can be considered as an infinite Cartesian plane, had two perfect rings, painted with solid black paint. As Sasha is very impulsive, the rings could have different radii and sizes, they intersect and overlap with each other in any way. We know only one thing for sure: the centers of the pair of rings are not the same.When Sasha got tired and fell into a deep sleep, a girl called Ilona came into the room and wanted to cut a circle for the sake of good memories. To make the circle beautiful, she decided to cut along the contour.We'll consider a contour to be a continuous closed line through which there is transition from one color to another (see notes for clarification). If the contour takes the form of a circle, then the result will be cutting out a circle, which Iona wants.But the girl's inquisitive mathematical mind does not rest: how many ways are there to cut a circle out of the canvas?

The input contains two lines.  Each line has four space-separated integers xi, yi, ri, Ri, that describe the i-th ring; xi and yi are coordinates of the ring's center, ri and Ri are the internal and external radii of the ring correspondingly ( - 100 ≤ xi, yi ≤ 100; 1 ≤ ri < Ri ≤ 100).  It is guaranteed that the centers of the rings do not coinside.

A single integer — the number of ways to cut out a circle from the canvas.

NoteFigures for test samples are given below. The possible cuts are marked with red dotted line.

                     program pr1;

{$APPTYPE CONSOLE}

const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :extended;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }
    function ainb(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (d+rr1<rr2+eps) then flag:=true else flag:=false;

     ainb:=flag;
 end;
        function asnarb(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (rr1+rr2<d+eps) then flag:=true else flag:=false;

    asnarb:=flag;
 end;

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (d<rr1+rr2-eps)and(d>max(rr1,rr2)-min(rr1,rr2)+eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }
              dd:=sqrt((x[1]-x[3])*(x[1]-x[3])+(y[1]-y[3])*(y[1]-y[3]));
        { writeln(dd:0:4,' ',r[1]:0:4,' ',r[4]:0:4);
     writeln(ainb(dd,r[3],r[1]),' ',ainb(dd,r[1],r[4]),' ',perkr(dd,r[1],r[4]));  }
 if not (ainb(dd,r[3],r[1]) and  ainb(dd,r[1],r[4])) and not perkr(dd,r[1],r[3]) and not perkr(dd,r[1],r[4])and not(ainb(dd,r[1],r[4]) and  asnarb(dd,r[1],r[3]))  then inc(ot);
 if not (ainb(dd,r[3],r[2]) and  ainb(dd,r[2],r[4])) and not perkr(dd,r[2],r[3]) and not perkr(dd,r[2],r[4])and not(ainb(dd,r[2],r[4]) and  asnarb(dd,r[2],r[3])) then inc(ot);
 if not (ainb(dd,r[1],r[3]) and  ainb(dd,r[3],r[2])) and not perkr(dd,r[1],r[3]) and not perkr(dd,r[2],r[3])and not(ainb(dd,r[3],r[2]) and  asnarb(dd,r[3],r[1])) then inc(ot);
 if not (ainb(dd,r[1],r[4]) and  ainb(dd,r[4],r[2])) and not perkr(dd,r[1],r[4]) and not perkr(dd,r[2],r[4])and not(ainb(dd,r[4],r[2]) and  asnarb(dd,r[4],r[1])) then inc(ot);

  writeln(ot);

   1:          close(output);
end.

Uses Math;
Type tm=Array [1..4] of LongInt;
     tf=Array [1..4] of Boolean;
Var x,y,r:tm;
    m:tf;
    kol,a,b,c,d,i:LongInt;

Function Prov (x1,y1,r1,x2,y2,r2:LongInt):Boolean;
Var r:Real;
Begin
     r:=sqrt (sqr (x1-x2)+sqr(y1-y2));
     If r>=r1+r2
     then Result:=True
     else If r+Min (r1,r2)<=Max (r1,r2)
          then Result:=True
          else Result:=False;
End;

Function Inn (k,i,j:LongInt):Boolean;
Var r1,r2:Real;
Begin
     r1:=sqrt (sqr (x[k]-x[i]-r[k])+sqr(y[k]-y[i]));
     r2:=sqrt (sqr (x[k]-x[i]+r[k])+sqr(y[k]-y[i]));
     If (r[j]>=r1) and (r[i]<=r1) and (r[j]>=r2) and (r[i]<=r2)
     then Result:=True
     else Result:=False;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     Readln (a,b,c,d); x[1]:=a; x[2]:=a; y[1]:=b; y[2]:=b; r[1]:=c; r[2]:=d;
     Readln (a,b,c,d); x[3]:=a; x[4]:=a; y[3]:=b; y[4]:=b; r[3]:=c; r[4]:=d;
     FillChar (m,sizeof (tm),False);
     kol:=0;
     If Prov (x[1],y[1],r[1],x[3],y[3],r[3]) and Prov (x[1],y[1],r[1],x[4],y[4],r[4]) then m[1]:=True;
     If Prov (x[2],y[2],r[2],x[3],y[3],r[3]) and Prov (x[2],y[2],r[2],x[4],y[4],r[4]) then m[2]:=True;
     If Prov (x[3],y[3],r[3],x[1],y[1],r[1]) and Prov (x[3],y[3],r[3],x[2],y[2],r[2]) then m[3]:=True;
     If Prov (x[4],y[4],r[4],x[1],y[1],r[1]) and Prov (x[4],y[4],r[4],x[2],y[2],r[2]) then m[4]:=True;
     For I:=1 to 4 do
     If m[i] then Inc (kol);
     If m[1] and (Inn (1,3,4)) then Dec (kol);
     If m[2] and (Inn (2,3,4)) then Dec (kol);
     If m[3] and (Inn (3,1,2)) then Dec (kol);
     If m[4] and (Inn (4,1,2)) then Dec (kol);
     Writeln (kol);
End.

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;
  p, s, b: integer;

function Peres(u, v: integer): boolean;
var
  a, b, c: real;
begin
  Result := false;
  a := r[u];
  b := r[v];
  c := sqrt(sqr(x[u] - x[v]) + sqr(y[u] - y[v]));

  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

Function into(u, v: integer): boolean;
var
  a, b, c: real;
begin
  Result := false;
  a := r[v];
  b := r[u];
  c := sqrt(sqr(x[u] - x[v]) + sqr(y[u] - y[v]));

  if (a > c + b - 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1];
  y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3];
  y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      p := i div 3;
      s := 1;
      b := 2;
      if p = 0 then
        begin
          s := 3;
          b := 4;
        end;

      if i mod 2 = 1 then
        begin
          if Peres(i, s) or (into(i, b) and not(into(i, s))) or peres(i, b) then
            f := 1;
        end
      else
       begin
         if (into(i, b) and not(into(i, s))) or peres(i, b) or peres(i, s) then
           f := 1;
       end;

      if f = 0 then
        inc(a);
    end;
  write(a);
end.

{$R-,S-,Q-,I-,O+}
{$M 64000000}

{$APPTYPE CONSOLE}

uses Math;
const
maxn = 2222;
type
circle=record
       x,y,r : integer;
       end;
var
x,y,r,rr,ans : integer;
c : array [1..4] of circle;

function cross (a,b : integer) : boolean;
begin
 if sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y)>=sqr(c [a].r+c [b].r) then
 begin
  cross:=false;
  exit;
 end;
 if sqr(max (c [a].r,c [b].r)-min (c [a].r,c [b].r))>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  cross:=false;
  exit;
 end;
 cross:=true;
end;

function into (a,b : integer) : boolean;
begin
 if c [b].r-c [a].r<=0 then
 begin
  into:=false;
  exit;
 end;
 if sqr(c [b].r-c [a].r)>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  into:=true;
  exit;
 end;
 into:=false;
end;

function fill (a,b,d : integer) : boolean;
begin
 if (sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y)>=sqr(c [a].r+c [b].r)) and into (a,d) then fill:=true
                                                                                else fill:=false;
end;

begin
 //reset (input,'input.txt');
 //rewrite (output,'output.txt');
 readln (x,y,r,rr);
 c [1].x:=x; c [2].x:=x;
 c [1].y:=y; c [2].y:=y;
 c [1].r:=r; c [2].r:=rr;
 readln (x,y,r,rr);
 c [3].x:=x; c [4].x:=x;
 c [3].y:=y; c [4].y:=y;
 c [3].r:=r; c [4].r:=rr;

 ans:=0;
 if not cross (1,3) and not cross (1,4) and not (into (1,4) and into (3,1)) and not fill (1,3,4) then inc (ans);
 if not cross (2,3) and not cross (2,4) and not (into (2,4) and into (3,2)) and not fill (2,3,4) then inc (ans);
 if not cross (3,1) and not cross (3,2) and not (into (3,2) and into (1,3)) and not fill (3,1,2) then inc (ans);
 if not cross (4,1) and not cross (4,2) and not (into (4,2) and into (1,4)) and not fill (4,1,2) then inc (ans);
 writeln (ans);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;

{function gcd(a,b:integer):integer;
begin
if b=0 then gcd:=a
       else gcd:=gcd(b,a mod b);
end;
for k:=1 to n-1 do
 for i:=1 to n-k do
  if a[i]>a[i+1] then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; end;}

var x1,y1,x2,y2,r1,r2,rt1,rt2,ans:integer;
    dist:real;

begin
readln(x1,y1,r1,rt1);
readln(x2,y2,r2,rt2);
dist:=sqrt(sqr(x1-x2)+sqr(y1-y2));
                                ans:=0;
if (dist+r1<=r2) or (dist+rt2<=r1) or (r1+rt2<=dist) then inc(ans);
if (dist+r2<=r1) or (dist+rt1<=r2) or (r2+rt1<=dist) then inc(ans);
if (rt1>=dist+rt2) or (rt1+rt2<=dist) or (dist+rt1<=r2) then inc(ans);
if (rt2>=dist+rt1) or (rt1+rt2<=dist) or (dist+rt2<=r1) then inc(ans);
write(ans);
readln;
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,prov:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    prov:=0;
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
        if prov=1 then write('t1');
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
        if prov=1 then write('t2');
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
        if prov=1 then write('t3');
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
        if prov=1 then write('t4');
    end;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if (r1<=(r3+cr)) and ((r3+cr)<=r2) and ((r3>r1) or (cr>r1)) then begin
        o3:=0;
        if prov=1 then write('t5');
    end;
    if (r1<=(r4+cr)) and ((r4+cr)<=r2) and ((r4>r1) or (cr>r1)) then begin
        o4:=0;
        if prov=1 then write('t6');
    end;
    if (r3<=(r1+cr)) and ((r1+cr)<=r4) and ((r1>r3) or (cr>r3)) then begin
        o1:=0;
        if prov=1 then write('t7');
    end;
    if (r3<=(r2+cr)) and ((r2+cr)<=r4) and ((r2>r3) or (cr>r3)) then begin
        o2:=0;
        if prov=1 then write('t8');
    end;
    if prov=1 then writeln;
    writeln(o1+o2+o3+o4);
    (*writeln(o1,o2,o3,o4);*)
end.

var
  x1,y1,x2,y2,r1,r2,rr1,rr2:extended;
  ans:longint;

function distance(x1,y1,x2,y2:extended):extended;
  begin
    exit(sqrt(sqr(x1-x2)+sqr(y1-y2)));
  end;

function inside(x1,y1,r1,x2,y2,r2:extended):boolean;
  begin
    exit(distance(x1,y1,x2,y2)+r1<=r2);
  end;

function outside(x1,y1,r1,x2,y2,r2:extended):boolean;
  begin
    exit((distance(x1,y1,x2,y2)>=r1+r2) or inside(x2,y2,r2,x1,y1,r1));
  end;

begin
  readln(x1,y1,r1,rr1);
  readln(x2,y2,r2,rr2);
  if outside(x1,y1,r1,x2,y2,rr2) or inside(x1,y1,r1,x2,y2,r2) then inc(ans);
  if outside(x1,y1,rr1,x2,y2,rr2) or inside(x1,y1,rr1,x2,y2,r2) then inc(ans);
  if outside(x2,y2,r2,x1,y1,rr1) or inside(x2,y2,r2,x1,y1,r1) then inc(ans);
  if outside(x2,y2,rr2,x1,y1,rr1) or inside(x2,y2,rr2,x1,y1,r1) then inc(ans);
  writeln(ans);
end.

uses math;

Var x1,y1,x2,y2,r1,rr1,r2,rr2:longint;
    k1,k2,k3,k4:longint;
    kil:longint;

Function ask1(x1,y1,r1,x2,y2,r2:longint):longint;

Begin

ask1:=0;

if r1>r2 then exit;

if sqr(x1-x2)+sqr(y1-y2)<=sqr(r1-r2) then ask1:=1;

end;

Function ask2(x1,y1,r1,x2,y2,r2:longint):longint;

Begin

ask2:=0;

if sqr(x1-x2)+sqr(y1-y2)<sqr(r1+r2) then ask2:=1;

end;

Begin

Readln(x1,y1,r1,rr1);
Readln(x2,y2,r2,rr2); k1:=0; k2:=0; k3:=0; k4:=0;

kil:=4;

if (x1=y1)and(x2=y2) then begin

if (r1=r2)or(r1=rr2) then dec(kil);
if (rr1=r2)or(rr1=rr2) then dec(kil); end;

if kil<4 then begin  Writeln(2); halt; end;

if (ask1(x1,y1,r1,x2,y2,r2)=1)or
   (ask1(x2,y2,rr2,x1,y1,r1)=1)or
   (sqr(x1-x2)+sqr(y1-y2)>=sqr(r1+rr2)) then k1:=1;

if (ask1(x1,y1,rr1,x2,y2,r2)=1)or
   (ask1(x2,y2,rr2,x1,y1,rr1)=1)or
   (sqr(x1-x2)+sqr(y1-y2)>=sqr(rr1+rr2)) then k2:=1;

if (ask1(x2,y2,r2,x1,y1,r1)=1)or
   (ask1(x1,y1,rr1,x2,y2,r2)=1)or
   (sqr(x1-x2)+sqr(y1-y2)>=sqr(rr1+r2)) then k3:=1;

if (ask1(x2,y2,rr2,x1,y1,r1)=1)or
   (ask1(x1,y1,rr1,x2,y2,rr2)=1)or
   (sqr(x1-x2)+sqr(y1-y2)>=sqr(rr1+rr2)) then k4:=1;

Writeln(k1+k2+k3+k4);

ENd.

var x1,y1,r1,rr1,x2,y2,r2,rr2,q:longint;s:extended;
begin
 readln(x1,y1,r1,rr1);
 readln(x2,y2,r2,rr2);
 s:=sqrt(sqr(x1-x2)+sqr(y1-y2));q:=0;
 if (s>=r1+r2)and(s>=r1+rr2)then inc(q);
 if (r2>=s+r1)and(rr2>=s+r1)then inc(q);
 if (r1>=s+r2)and(r1>=s+rr2)then inc(q);

 if (s>=rr1+r2)and(s>=rr1+rr2)then inc(q);
 if (r2>=s+rr1)and(rr2>=s+rr1)then inc(q);
 if (rr1>=s+r2)and(rr1>=s+rr2)then inc(q);

 if (s>=r2+r1)and(s>=r2+rr1)then inc(q);
 if (r1>=s+r2)and(rr1>=s+r2)then inc(q);
 if (r2>=s+r1)and(r2>=s+rr1)then inc(q);

 if (s>=rr2+r1)and(s>=rr2+rr1)then inc(q);
 if (r1>=s+rr2)and(rr1>=s+rr2)then inc(q);
 if (rr2>=s+r1)and(rr2>=s+rr1)then inc(q);
 writeln(q);
end.

// buneng CE!
var
        len,x1,y1,x2,y2:double;
        r1,r11,r2,r22:longint;
        ans:longint;
        b:array[0..101]of longint;

begin

        readln(x1,y1,r1,r11);
        readln(x2,y2,r2,r22);
        len:=sqrt(sqr(x1-x2)+sqr(y1-y2));
        ans:=0;
       { fillchar(b,sizeof(b),0);
        if (len-r1)>0 then
        begin
        if ((len-r1)>=r22)or((len+r1)<=r2)and(b[r1]=0) then
        begin
                inc(ans);
                b[r1]:=1;
        end;
        end
        else
        begin
                if (r22<=(r1-len))or((len+r1)<=r2)and(b[r1]=0) then
                begin
                inc(ans);
                b[r1]:=1;
                end;
        end;
        if (len-r11)>0 then
        begin
        if ((len-r11)>=r22)or((len+r11)<=r2)and(b[r11]=0) then
        begin
                inc(ans);
                b[r11]:=1;
        end;
        end
        else
        begin
                if (r22<=(r11-len))or((len+r11)<=r2)and(b[r11]=0) then
                begin
                inc(ans);
                b[r11]:=1;
        end;
        end;
        if (len-r2)>0 then
        begin
        if ((len-r2)>=r11)or((len+r2)<=r1)and(b[r2]=0) then
        begin
                inc(ans);
                b[r2]:=1;
        end;
        end
        else
        begin
                if (r11<=(r2-len))or((len+r2)<=r1)and(b[r2]=0) then
                begin
                inc(ans);
                b[r2]:=1;
        end;
        end;
        if (len-r22)>0 then
        begin
        if ((len-r22)>=r11)or((len+r22)<=r1)and(b[r22]=0) then
        begin
                inc(ans);
                b[r22]:=1;
        end;
        end
        else
        begin
                if (r11<=(r2-len))or((len+r22)<=r1)and(b[r22]=0) then
                begin
                inc(ans);
                b[r22]:=1;
        end;
        end;     }
        if ((r22+r1)<=len)or((r1+len)<=r2)or((len+r22)<=r1) then inc(ans);
        if ((r22+r11)<=len)or((r11+len)<=r2)or((len+r22)<=r11) then inc(ans);
        if ((r11+r2)<=len)or((r2+len)<=r1)or((len+r11)<=r2) then inc(ans);
        if ((r11+r22)<=len)or((r22+len)<=r1)or((len+r11)<=r22) then inc(ans);

        writeln(ans);

end.

program problemB;
var
 ans,i,j:longint;
 x,y:array[1..2]of longint;
 r:array[1..2,1..2]of longint;

function minn(a,b:longint):longint;
begin
 if a<b then minn:=a else minn:=b;
end;

function check1(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,1]) then exit(true);
 if (r[3-p,1]>r[p,1])and(dist<=sqr(r[3-p,1]-r[p,1])) then exit(true);
 if (r[p,1]>r[3-p,2])and(dist<=sqr(r[p,1]-r[3-p,2])) then exit(true);
 exit(false);
end;

function check2(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,2]) then exit(true);
 if (r[3-p,1]>r[p,2])and(dist<=sqr(r[3-p,1]-r[p,2])) then exit(true);
 if (r[p,2]>r[3-p,2])and(dist<=sqr(r[p,2]-r[3-p,2])) then exit(true);
 exit(false);
end;

begin
{$ifndef ONLINE_JUDGE}
 assign(input,'B.in');
 reset(input);
 assign(output,'B.out');
 rewrite(output);
{$endif}

 readln(x[1],y[1],r[1,1],r[1,2]);
 readln(x[2],y[2],r[2,1],r[2,2]);

 ans:=0;
 if check1(1) then inc(ans);
 if check2(1) then inc(ans);
 if check1(2) then inc(ans);
 if check2(2) then inc(ans);
 writeln(ans);
end.

const maxn=5;
type cir = record
x,y,r:longint;
end;

var f1,f2:text;
A:array[1..maxn] of cir;
C:array[1..maxn] of longint;
x1,y1,r1,r2,i,j:longint;
res:longint;
d:double;
ok:boolean;
d1,d2:longint;
begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,x1,y1,r1,r2);
        A[1].x:=x1;a[1].y:=y1;a[1].r:=r1;
        A[2].x:=x1;a[2].y:=y1;a[2].r:=r2;
        readln(f1,x1,y1,r1,r2);
        A[3].x:=x1;a[3].y:=y1;a[3].r:=r1;
        A[4].x:=x1;a[4].y:=y1;a[4].r:=r2;
        For i:=1 to 2 do
        Begin
          ok:=true;
          for j:=3 to 4 do
          begin
            d:=sqrt(sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x));
            if a[i].r+a[j].r<=d then C[j]:=1 else
            if ABS(a[i].r-a[j].r)>=d then
            Begin
              if a[i].r>a[j].r then C[j]:=2
              else c[j]:=3;
            end
            else
            ok:=false;
          end;
          if ok and (C[3]=C[4]) then inc(res);
        End;
        For i:=3 to 4 do
        Begin
          ok:=true;
          for j:=1 to 2 do
          begin
            d:=sqrt(sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x));
            if a[i].r+a[j].r<=d then C[j]:=1 else
            if ABS(a[i].r-a[j].r)>=d then
            Begin
              if a[i].r>a[j].r then C[j]:=2
              else c[j]:=3;
            End
            else
            ok:=false;
          end;
          if ok and (C[1]=C[2]) then inc(res);
        End;
        writeln(f2,res);
        close(f1);
        close(f2);
end.

const fi='';
type hkr=record x,y,r:shortint end;
var a,b,c,d,kq:shortint;
    cir1,cir2,cir3,cir4:hkr;
    b1,b2,b3,b4:boolean;
    dis:real; f:text;
function NI(a,b,c:hkr):boolean;
begin
     if b.r-a.r>=dis then exit(true);
     if a.r+c.r<=dis then exit(true);
     if a.r-c.r>=dis then exit(true);
     exit(false);
end;
begin
     assign(f,fi);reset(f);
     readln(f,a,b,c,d);
     with cir1 do begin x:=a; y:=b; r:=c; end;
     with cir2 do begin x:=a; y:=b; r:=d; end;
     readln(f,a,b,c,d);
     with cir3 do begin x:=a; y:=b; r:=c; end;
     with cir4 do begin x:=a; y:=b; r:=d; end;
     close(f);
     dis:=sqrt(sqr(cir1.x-cir3.x)+sqr(cir1.y-cir3.y));
     b1:=NI(cir1,cir3,cir4);
     b2:=NI(cir2,cir3,cir4);
     b3:=NI(cir3,cir1,cir2);
     b4:=NI(cir4,cir1,cir2);
     if b1 then inc(kq);
     if b2 then inc(kq);
     if b3 then inc(kq);
     if b4 then inc(kq);
     writeln(kq);
end.

var x1,y1,x2,y2,r1,r2,r3,r4:longint;
    ans:longint;
function jiao(x1,y1,r1,x2,y2,r2:longint):boolean;
  var t:longint;
  begin
  t:=sqr(x1-x2)+sqr(y1-y2);
  jiao:=(t<sqr(r1+r2)) and (t>sqr(r1-r2));
  end;
function init(x1,y1,r1,r2,x2,y2,r3:longint):boolean;
  var t:longint; p:boolean;
  begin
  t:=sqr(x1-x2)+sqr(y1-y2);
  p:=(r3*2<=abs(r1-r2)) and (t>sqr(r1)) and (t<sqr(r2)) and
  not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y2,r2,x2,y2,r3);

  if not p then
    begin
    p:=  not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y2,r2,x2,y2,r3) and
    (r3>=r1) and (r3<=r2) and (x1-r1>=x2-r3) and (x1+r1<=x2+r3)
    and (x1-r2<=x2-r3) and (x1+r2>=x2+r3);
    end;
  init:=p;
  end;
begin
  readln(x1,y1,r1,r2);
  readln(x2,y2,r3,r4);
  ans:=0;
  if not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y1,r1,x2,y2,r4)
  and not init(x2,y2,r3,r4,x1,y1,r1)then
    inc(ans);
//  writeln(ans);
  if not jiao(x1,y1,r2,x2,y2,r3) and not jiao(x1,y1,r2,x2,y2,r4)
    and not init(x2,y2,r3,r4,x1,y1,r2)then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r3,x1,y1,r1) and not jiao(x2,y2,r3,x1,y1,r2)
    and not init(x1,y1,r1,r2,x2,y2,r3) then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r4,x1,y1,r1) and not jiao(x2,y2,r4,x1,y1,r2)
    and not init(x1,y1,r1,r2,x2,y2,r4) then
    inc(ans);
//  writeln(ans);
  writeln(ans);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if (((z-x)*abs(z-x)<=ll)and(ll<=(x-z)*abs(x-z)))or(len>=(x+z)*(x+z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<=ll)and(ll<=(y-x)*abs(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

type
 ongint=extended;
var x1,y1,x2,y2,i1,o1,i2,o2:ongint;
    ans:longint;

 procedure check(x,y,r,x1,y1,i1,o1:ongint);

  function f(x,y,r,x1,y1,r1,r2:ongint):boolean;
   var d:ongint;

    procedure swap(var a,b:ongint);
     var c:ongint;
      begin
       c:=a; a:=b; b:=c;
      end;

   begin
    d:=sqrt(sqr(x-x1)+sqr(y-y1));
    if d+r<=r1 then exit(true);
    if r+r2<=d then exit(true);
    if d+r2<=r then exit(true);
    exit(false);
   end;

   begin
     if not f(x,y,r,x1,y1,i1,o1) then exit;
     inc(ans);
    end;

 begin
  readln(x1,y1,i1,o1);
  readln(x2,y2,i2,o2);
  check(x1,y1,i1,x2,y2,i2,o2);
  check(x1,y1,o1,x2,y2,i2,o2);
  check(x2,y2,i2,x1,y1,i1,o1);
  check(x2,y2,o2,x1,y1,i1,o1);
  write(ans);
 end.

type
 cir=record
  x,y,r:longint;
 end;
var
 c1,c2,c3,c4:cir;
 tot,i,j,k,x,y:longint;
function inter(o,a,b:cir):boolean;
 var
  i,j,k:longint;
  dis:real;
 begin
  dis:=sqrt(sqr(o.x-a.x)+sqr(o.y-a.y));
  if (dis>abs(o.r-a.r))and(dis<o.r+a.r) then exit(true);
  if (dis>abs(o.r-b.r))and(dis<o.r+b.r) then exit(true);
  if (o.r>a.r)and(dis<=abs(o.r-a.r))and(dis<=abs(o.r-b.r))and(o.r<b.r) then exit(true);
  if (dis>=o.r+a.r)and(o.r<b.r)and(dis<=abs(o.r-b.r)) then exit(true);
  exit(false);
 end;
begin
 read(x,y);
 c1.x:=x;c2.x:=x;c1.y:=y;c2.y:=y;
 readln(c1.r,c2.r);
 read(x,y);
 c3.x:=x;c4.x:=x;c3.y:=y;c4.y:=y;
 readln(c3.r,c4.r);
 tot:=0;
 if not inter(c1,c3,c4) then inc(tot);
 if not inter(c2,c3,c4) then inc(tot);
 if not inter(c3,c1,c2) then inc(tot);
 if not inter(c4,c1,c2) then inc(tot);
 writeln(tot);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2+a1))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1+a2))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f2=true then
    if ((dist<=r1+r2)and(r1>=r2)and(dist+r1<=d2)and(r1<=d2))or((dist>=r1+r2)and(dist+r1<=d2)) then f2:=false;
  if f1=true then
    if ((dist<=r2+d1)and(d1>=r2)and(dist+d1<=d2)and(d1<=d2))or((dist>=d1+r2)and(dist+d1<=d2)) then f1:=false;
  if f4=true then
    if ((dist<=r1+r2)and(r2>=r1)and(dist+r2<=d1)and(r2<=d1))or((dist>=r1+r2)and(dist+r2<=d1)) then f4:=false;
  if f3=true then
    if ((dist<=r1+d2)and(d2>=r1)and(dist+d2<=d1)and(d2<=d1))or((dist>=d2+r1)and(dist+d2<=d1)) then f3:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

uses math;
const
        tfi     =       '';
        tfo     =       '';
        nmax    =       101;
type
        arr1    =       array[0..nmax] of longint;
var
        fi,fo:text;
        n,m:longint;
        x1,x2,y1,y2,rnho1,rnho2,rlon1,rlon2,res:longint;
procedure nhap;
var i,j,u,v:longint;
begin
        read(fi,x1,y1,rnho1,rlon1);
        read(fi,x2,y2,rnho2,rlon2);
end;
function ngoai(x1,y1,r1,x2,y2,r2:longint):boolean;
var kc:longint;
begin
        kc:=sqr(x1-x2)+sqr(y1-y2);
        if sqr(r1+r2)<=kc then exit(true)
        else exit(false);
end;
function trong(x1,y1,r1,x2,y2,r2:longint):boolean;
var kc:longint;
begin
        kc:=sqr(x1-x2)+sqr(y1-y2);
        if (r1<r2)and(sqr(r1-r2)>=kc) then exit(true)
        else exit(false);
end;
procedure xuly;
var i,j,u,v:longint;
begin
        res:=0;
        if ngoai(x1,y1,rnho1,x2,y2,rlon2) or
           trong(x1,y1,rnho1,x2,y2,rnho2) or
           trong(x2,y2,rlon2,x1,y1,rnho1) then inc(res);
        if ngoai(x1,y1,rlon1,x2,y2,rlon2) or
           trong(x1,y1,rlon1,x2,y2,rnho2) or
           trong(x2,y2,rlon2,x1,y1,rlon1) then inc(res);
        if ngoai(x2,y2,rnho2,x1,y1,rlon1) or
           trong(x2,y2,rnho2,x1,y1,rnho1) or
           trong(x1,y1,rlon1,x2,y2,rnho2) then inc(res);
        if ngoai(x2,y2,rlon2,x1,y1,rlon1) or
           trong(x2,y2,rlon2,x1,y1,rnho1) or
           trong(x1,y1,rlon1,x2,y2,rlon2) then inc(res);
        writeln(fo,res);
end;
begin
        assign(fi,tfi);reset(fi);
        assign(fo,tfo);rewrite(fo);
          nhap;
          xuly;
        close(fi);
        close(fo);
end.

const   finp='';
        fout='';
var     fi,fo:text;
        x,y,r1,r2:array[1..2]of double;
        dist:double;
procedure enter;
var     i:longint;
begin
        assign(fi,finp);reset(fi);
                for i:=1 to 2 do
                        readln(fi,x[i],y[i],r1[i],r2[i]);
        close(fi);
end;
function incircle(r1,r2:double):boolean;
begin
        if (abs(dist-r2) <= r1) and (dist+r2 <= r1) then exit(true);
        exit(false);
end;
function outcircle(r1,r2:double):boolean;
begin
        if (abs(dist-r2) >= r1) and (dist+r2 >= r1) then exit(true);
        exit(false);
end;
procedure solve;
var     res:longint;
begin
        assign(fo,fout);rewrite(fo);
                dist:=sqrt(sqr(x[1]-x[2])+sqr(y[1]-y[2]));
                res:=0;
                if (incircle(r1[1],r1[2]))
                or (outcircle(r2[1],r1[2])) then res:=res+1;
                if (incircle(r1[1],r2[2]))
                or (outcircle(r2[1],r2[2])) then res:=res+1;
                if (incircle(r1[2],r1[1]))
                or (outcircle(r2[2],r1[1])) then res:=res+1;
                if (incircle(r1[2],r2[1]))
                or (outcircle(r2[2],r2[1])) then res:=res+1;
                writeln(fo,res);
        close(fo);
end;
begin
        enter;
        solve;
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-10;
    if (d<rr1+rr2-eps)and(d>max(rr1,rr2)-min(rr1,rr2)+eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then begin flag:=false; {writeln(i,' ===',j); }  end;
          end;
      { writeln(i,' ',flag); }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-10;
    if (d<rr1+rr2-eps)and(d>max(rr1,rr2)-min(rr1,rr2)-eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then begin flag:=false; {writeln(i,' ===',j); }  end;
          end;
      { writeln(i,' ',flag); }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-10;
    if (d<rr1+rr2+eps)and(d>max(rr1,rr2)-min(rr1,rr2)-eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then begin flag:=false; {writeln(i,' ===',j); }  end;
          end;
      { writeln(i,' ',flag); }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-10;
    if (d<rr1+rr2+eps)and(d>max(rr1,rr2)-min(rr1,rr2)+eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then begin flag:=false; {writeln(i,' ===',j); }  end;
          end;
      { writeln(i,' ',flag); }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
 eps=0.000000001;  nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-16;
    if (d<rr1+rr2-eps)and(d>max(rr1,rr2)-min(rr1,rr2)) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
     { for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then flag:=false;
          end;
      { writeln(i,' ',flag);  }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

                     program pr1;

{$APPTYPE CONSOLE}

const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :extended;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }
    function ainb(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (d+rr1<rr2+eps) then flag:=true else flag:=false;

     ainb:=flag;
 end;
        function asnarb(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (rr1+rr2<d+eps) then flag:=true else flag:=false;

    asnarb:=flag;
 end;

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=1e-15;
    if (d<rr1+rr2-eps)and(d>max(rr1,rr2)-min(rr1,rr2)+eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }
              dd:=sqrt((x[1]-x[3])*(x[1]-x[3])+(y[1]-y[3])*(y[1]-y[3]));
        { writeln(dd:0:4,' ',r[1]:0:4,' ',r[4]:0:4);
     writeln(ainb(dd,r[3],r[1]),' ',ainb(dd,r[1],r[4]),' ',perkr(dd,r[1],r[4]));  }
 if not (ainb(dd,r[3],r[1]) and  ainb(dd,r[1],r[4])) and not perkr(dd,r[1],r[3]) and not perkr(dd,r[1],r[4]) then inc(ot);
 if not (ainb(dd,r[3],r[2]) and  ainb(dd,r[2],r[4])) and not perkr(dd,r[2],r[3]) and not perkr(dd,r[2],r[4]) then inc(ot);
 if not (ainb(dd,r[1],r[3]) and  ainb(dd,r[3],r[2])) and not perkr(dd,r[1],r[3]) and not perkr(dd,r[2],r[3]) then inc(ot);
 if not (ainb(dd,r[1],r[4]) and  ainb(dd,r[4],r[2])) and not perkr(dd,r[1],r[4]) and not perkr(dd,r[2],r[4]) then inc(ot);

  writeln(ot);

   1:          close(output);
end.

                 program pr1;

{$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;
 label 1,2,3,4;
var i0,j0,pp,jj,kolzn,k,kk,step,i,j,ii,start,finish,per:longint;
kor,bal,ot,p,t,t2,dx1,dy1,t1old,t2old,f,c,n,mmin,imin,p1,p2,s,l,m,k1,k2,a2:int64;
centr,aa,bb,cc,koef:int64;  ch,ch1,ch2:char;
r,num,x,y,b,r1,r2:array[0..1000000] of extended;
flag2,flag1,flag:boolean;
c1,c2:char;
sum:array['a'..'z',0..500000] of int64;
marked:array[0..500] of boolean;
gr:array['a'..'z','a'..'z'] of boolean;
dd :double;
namemin:string;
ss:string;{array[0..1100000] of char;}
name:array[0..2000] of string;
function min (a,b:extended):extended;begin min:=b;if a<b then min:=a;  end;
function max (a,b:extended):extended;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:longint):longint; var p,t:longint;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function perkr(d,rr1,rr2:extended):boolean;
    var flag:boolean; eps:extended;
 begin
   eps:=0;
    if (d<rr1+rr2+eps)and(d>max(rr1,rr2)-min(rr1,rr2)-eps) then flag:=true else flag:=false;

     perkr:=flag;
 end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}
     read(x[1],y[1],r[1],r[2]);
     read(x[3],y[3],r[3],r[4]);
      x[2]:=x[1];y[2]:=y[1];
      x[4]:=x[3];y[4]:=y[3];
   {   for i:=1 to 4 do writeln(x[i]:0:3,' ',y[i]:0:3,' ',r[i]:0:3);
   }  for i:=1 to 4 do
       begin
          flag:=true;
       for j:=1 to 4 do if i<>j then
          begin
              dd:=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
            if perkr(dd,r[i],r[j]) then begin flag:=false; {writeln(i,' ===',j); }  end;
          end;
      { writeln(i,' ',flag); }
       if flag then inc(ot);
       end;

      writeln(ot);
   1:          close(output);
end.

Uses Math;
Type tm=Array [1..4] of LongInt;
     tf=Array [1..4] of Boolean;
Var x,y,r:tm;
    m:tf;
    kol,a,b,c,d,i:LongInt;

Function Prov (x1,y1,r1,x2,y2,r2:LongInt):Boolean;
Var r:Real;
Begin
     r:=sqrt (sqr (x1-x2)+sqr(y1-y2));
     If r>=r1+r2
     then Result:=True
     else If r+Min (r1,r2)<=Max (r1,r2)
          then Result:=True
          else Result:=False;
End;

Function Inn (k,i,j:LongInt):Boolean;
Var rr:Real;
Begin
     rr:=sqrt (sqr (x[k]-x[i]-r[k])+sqr(y[k]-y[i]));
     If (r[j]>rr) and (r[i]<rr)
     then Result:=True
     else Result:=False;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     Readln (a,b,c,d); x[1]:=a; x[2]:=a; y[1]:=b; y[2]:=b; r[1]:=c; r[2]:=d;
     Readln (a,b,c,d); x[3]:=a; x[4]:=a; y[3]:=b; y[4]:=b; r[3]:=c; r[4]:=d;
     FillChar (m,sizeof (tm),False);
     kol:=0;
     If Prov (x[1],y[1],r[1],x[3],y[3],r[3]) and Prov (x[1],y[1],r[1],x[4],y[4],r[4]) then m[1]:=True;
     If Prov (x[2],y[2],r[2],x[3],y[3],r[3]) and Prov (x[2],y[2],r[2],x[4],y[4],r[4]) then m[2]:=True;
     If Prov (x[3],y[3],r[3],x[1],y[1],r[1]) and Prov (x[3],y[3],r[3],x[2],y[2],r[2]) then m[3]:=True;
     If Prov (x[4],y[4],r[4],x[1],y[1],r[1]) and Prov (x[4],y[4],r[4],x[2],y[2],r[2]) then m[4]:=True;
     For I:=1 to 4 do
     If m[i] then Inc (kol);
     If m[1] and (Inn (1,3,4)) then Dec (kol);
     If m[2] and (Inn (2,3,4)) then Dec (kol);
     If m[3] and (Inn (3,1,2)) then Dec (kol);
     If m[4] and (Inn (4,1,2)) then Dec (kol);
     Writeln (kol);
End.

Uses Math;
Type tm=Array [1..4] of LongInt;
Var x,y,r:tm;
    kol,a,b,c,d:LongInt;
Function Prov (x1,y1,r1,x2,y2,r2:LongInt):Boolean;
Var r:Real;
Begin
     r:=sqrt (sqr (x1-x2)+sqr(y1-y2));
     If r>=r1+r2
     then Result:=True
     else If r+Min (r1,r2)<=Max (r1,r2)
          then Result:=True
          else Result:=False;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
    // Assign (output,'output.txt'); ReWrite (output);
     Readln (a,b,c,d); x[1]:=a; x[2]:=a; y[1]:=b; y[2]:=b; r[1]:=c; r[2]:=d;
     Readln (a,b,c,d); x[3]:=a; x[4]:=a; y[3]:=b; y[4]:=b; r[3]:=c; r[4]:=d;
     kol:=0;
     If Prov (x[1],y[1],r[1],x[3],y[3],r[3]) and Prov (x[1],y[1],r[1],x[4],y[4],r[4]) then Inc (kol);
     If Prov (x[2],y[2],r[2],x[3],y[3],r[3]) and Prov (x[2],y[2],r[2],x[4],y[4],r[4]) then Inc (kol);
     If Prov (x[3],y[3],r[3],x[1],y[1],r[1]) and Prov (x[3],y[3],r[3],x[2],y[2],r[2]) then Inc (kol);
     If Prov (x[4],y[4],r[4],x[1],y[1],r[1]) and Prov (x[4],y[4],r[4],x[2],y[2],r[2]) then Inc (kol);
     Writeln (kol);
End.

Uses Math;
Type tm=Array [1..4] of LongInt;
     tf=Array [1..4] of Boolean;
Var x,y,r:tm;
    m:tf;
    kol,a,b,c,d,i:LongInt;

Function Prov (x1,y1,r1,x2,y2,r2:LongInt):Boolean;
Var r:Real;
Begin
     r:=sqrt (sqr (x1-x2)+sqr(y1-y2));
     If r>=r1+r2
     then Result:=True
     else If r+Min (r1,r2)<=Max (r1,r2)
          then Result:=True
          else Result:=False;
End;

Function Inn (k,i,j:LongInt):Boolean;
Var r1,r2:Real;
Begin
     r1:=sqrt (sqr (x[k]-x[i]-r[k])+sqr(y[k]-y[i]));
     r2:=sqrt (sqr (x[k]-x[i]+r[k])+sqr(y[k]-y[i]));
     If (r[j]>r1) and (r[i]<r1) and (r[j]>r2) and (r[i]<r2)
     then Result:=True
     else Result:=False;
End;

Begin
     //Assign (input,'input.txt'); ReSet (input);
     //Assign (output,'output.txt'); ReWrite (output);
     Readln (a,b,c,d); x[1]:=a; x[2]:=a; y[1]:=b; y[2]:=b; r[1]:=c; r[2]:=d;
     Readln (a,b,c,d); x[3]:=a; x[4]:=a; y[3]:=b; y[4]:=b; r[3]:=c; r[4]:=d;
     FillChar (m,sizeof (tm),False);
     kol:=0;
     If Prov (x[1],y[1],r[1],x[3],y[3],r[3]) and Prov (x[1],y[1],r[1],x[4],y[4],r[4]) then m[1]:=True;
     If Prov (x[2],y[2],r[2],x[3],y[3],r[3]) and Prov (x[2],y[2],r[2],x[4],y[4],r[4]) then m[2]:=True;
     If Prov (x[3],y[3],r[3],x[1],y[1],r[1]) and Prov (x[3],y[3],r[3],x[2],y[2],r[2]) then m[3]:=True;
     If Prov (x[4],y[4],r[4],x[1],y[1],r[1]) and Prov (x[4],y[4],r[4],x[2],y[2],r[2]) then m[4]:=True;
     For I:=1 to 4 do
     If m[i] then Inc (kol);
     If m[1] and (Inn (1,3,4)) then Dec (kol);
     If m[2] and (Inn (2,3,4)) then Dec (kol);
     If m[3] and (Inn (3,1,2)) then Dec (kol);
     If m[4] and (Inn (4,1,2)) then Dec (kol);
     Writeln (kol);
End.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b > c) then
  if (a + c > b) then
  if (c + b > a) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;

      if f = 0 then
        inc(a);
    end;
  write(a);
end.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;
  p, s, b: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;
      p := i div 3;
      s := 1;
      b := 2;
      if p = 0 then
        begin
          s := 3;
          b := 4;
        end;
      if (r[s] * 1.0 + 0.0000000001 < sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j]))) then
        if r[b] * 1.0 + 0.0000000001 > sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])) then
          f := 1;
      if f = 0 then
        inc(a);
    end;
  write(a);
end.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b >= c) then
  if (a + c >= b) then
  if (c + b >= a) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;

      if f = 0 then
        inc(a);
    end;
  write(a);
end.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;
  p, s, b: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;
      p := i div 3;
      s := 1;
      b := 2;
      if p = 0 then
        begin
          s := 3;
          b := 4;
        end;
      if (r[s] * 1.0 + 0.0000000001 < sqrt(sqr(x[i] - x[s]) + sqr(y[i] - y[s]))) then
        if r[b] * 1.0 + 0.0000000001 > sqrt(sqr(x[i] - x[s]) + sqr(y[i] - y[s])) then
          f := 1;

      if sqr(x[i] + r[i] - x[s]) + sqr(y[i]- y[s]) >= r[s] * r[s] * 1.0 + 0.000000001 then
        if sqr(x[i] + r[i] - x[b]) + sqr(y[i]- y[b]) <= r[b] * r[b] * 1.0 - 0.000000001 then
          inc(f);
      if f = 0 then
        inc(a);
    end;
  write(a);
end.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;

      if f = 0 then
        inc(a);
    end;
  write(a);
end.

program Timur;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;
  p, s, b: integer;

function trig(a, b, c: real): boolean;
begin
  Result := false;
  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1]; y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3]; y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      for j := 1 to 4 do
        if i <> j then
          begin
            if trig(sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j])), r[i] * 1.0, 1.0 * r[j]) then
              inc(f);
          end;
      p := i div 3;
      s := 1;
      b := 2;
      if p = 0 then
        begin
          s := 3;
          b := 4;
        end;
      if (r[s]* r[s] * 1.0 + 0.0000000001 < sqrt(sqr(x[i] - x[s]) + sqr(y[i] - y[s]))) then
        if r[b] * r[b] * 1.0 + 0.0000000001 > sqrt(sqr(x[i] - x[s]) + sqr(y[i] - y[s])) then
          f := 1;

      if sqr(x[i] + r[i] - x[s]) + sqr(y[i]- y[s]) >= r[s] * r[s] * 1.0 + 0.000000001 then
        if sqr(x[i] + r[i] - x[b]) + sqr(y[i]- y[b]) <= r[b] * r[b] * 1.0 - 0.000000001 then
          inc(f);
      if f = 0 then
        inc(a);
    end;
  write(a);
end.

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  x, y, r: array [1..4] of integer;
  i, a, j, f: integer;
  p, s, b: integer;

function Peres(u, v: integer): boolean;
var
  a, b, c: real;
begin
  Result := false;
  a := r[u];
  b := r[v];
  c := sqrt(sqr(x[u] - x[v]) + sqr(y[u] - y[v]));

  if (a + b > c + 0.0000000001) then
  if (a + c > b + 0.0000000001) then
  if (c + b > a + 0.0000000001) then
    Result := true;
end;

Function into(u, v: integer): boolean;
var
  a, b, c: real;
begin
  Result := false;
  a := r[u];
  b := r[v];
  c := sqrt(sqr(x[u] - x[v]) + sqr(y[u] - y[v]));

  if (a > c + b + 0.0000000001) then
    Result := true;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(x[1], y[1], r[1], r[2]);
  x[2] := x[1];
  y[2] := y[1];
  read(x[3], y[3], r[3], r[4]);
  x[4] := x[3];
  y[4] := y[3];
  a := 0;
  for i := 1 to 4 do
    begin
      f := 0;
      p := i div 3;
      s := 1;
      b := 2;
      if p = 0 then
        begin
          s := 3;
          b := 4;
        end;

      if i mod 2 = 1 then
        begin
          if Peres(i, s) or into(i, b) or peres(i, b) then
            f := 1;
        end
      else
       begin
         if into(i, b) or peres(i, b) or peres(i, s) then
           f := 1;
       end;

      if f = 0 then
        inc(a);
    end;
  write(a);
end.

{$R-,S-,Q-,I-,O+}
{$M 64000000}

{$APPTYPE CONSOLE}

uses Math;
const
maxn = 2222;
type
circle=record
       x,y,r : integer;
       end;
var
x,y,r,rr,i,j,ans : integer;
ok : boolean;
c : array [1..4] of circle;

function cross (a,b : integer) : boolean;
begin
 if sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y)>=sqr(c [a].r+c [b].r) then
 begin
  cross:=false;
  exit;
 end;
 if sqr(max (c [a].r,c [b].r)-min (c [a].r,c [b].r))>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  cross:=false;
  exit;
 end;
 cross:=true;
end;

begin
 //reset (input,'input.txt');
 //rewrite (output,'output.txt');
 readln (x,y,r,rr);
 c [1].x:=x; c [2].x:=x;
 c [1].y:=y; c [2].y:=y;
 c [1].r:=r; c [2].r:=rr;
 readln (x,y,r,rr);
 c [3].x:=x; c [4].x:=x;
 c [3].y:=y; c [4].y:=y;
 c [3].r:=r; c [4].r:=rr;

 ans:=0;
 for i:=1 to 4 do
 begin
  ok:=true;
  for j:=1 to 4 do
  if i<>j then
   if cross (i,j) then
   begin
    ok:=false;
    break;
   end;
  if ok then inc (ans);
 end;
 writeln (ans);
end.

{$R-,S-,Q-,I-,O+}
{$M 64000000}

{$APPTYPE CONSOLE}

uses Math;
const
maxn = 2222;
type
circle=record
       x,y,r : integer;
       end;
var
x,y,r,rr,ans : integer;
c : array [1..4] of circle;

function cross (a,b : integer) : boolean;
begin
 if sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y)>=sqr(c [a].r+c [b].r) then
 begin
  cross:=false;
  exit;
 end;
 if sqr(max (c [a].r,c [b].r)-min (c [a].r,c [b].r))>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  cross:=false;
  exit;
 end;
 cross:=true;
end;

function into (a,b : integer) : boolean;
begin
 if c [b].r-c [a].r<=0 then
 begin
  into:=false;
  exit;
 end;
 if sqr(c [b].r-c [a].r)>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  into:=true;
  exit;
 end;
 into:=false;
end;

begin
 //reset (input,'input.txt');
 //rewrite (output,'output.txt');
 readln (x,y,r,rr);
 c [1].x:=x; c [2].x:=x;
 c [1].y:=y; c [2].y:=y;
 c [1].r:=r; c [2].r:=rr;
 readln (x,y,r,rr);
 c [3].x:=x; c [4].x:=x;
 c [3].y:=y; c [4].y:=y;
 c [3].r:=r; c [4].r:=rr;

 ans:=0;
 if not cross (1,3) and not cross (1,4) and not (into (1,4) and into (3,1)) then inc (ans);
 if not cross (2,3) and not cross (2,4) and not (into (2,4) and into (3,2)) then inc (ans);
 if not cross (3,1) and not cross (3,2) and not (into (3,2) and into (1,3)) then inc (ans);
 if not cross (4,1) and not cross (4,2) and not (into (4,2) and into (1,4)) then inc (ans);
 writeln (ans);
end.

{$R-,S-,Q-,I-,O+}
{$M 64000000}

{$APPTYPE CONSOLE}

uses Math;
const
maxn = 2222;
type
circle=record
       x,y,r : integer;
       end;
var
x,y,r,rr,i,j,ans : integer;
ok : boolean;
c : array [1..4] of circle;

function cross (a,b : integer) : boolean;
begin
 if sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y)>sqr(c [a].r+c [b].r) then
 begin
  cross:=false;
  exit;
 end;
 if sqr(max (c [a].r,c [b].r)-min (c [a].r,c [b].r))>=sqr(c [a].x-c [b].x)+sqr(c [a].y-c [b].y) then
 begin
  cross:=false;
  exit;
 end;
 cross:=true;
end;

begin
 //reset (input,'input.txt');
 //rewrite (output,'output.txt');
 readln (x,y,r,rr);
 c [1].x:=x; c [2].x:=x;
 c [1].y:=y; c [2].y:=y;
 c [1].r:=r; c [2].r:=rr;
 readln (x,y,r,rr);
 c [3].x:=x; c [4].x:=x;
 c [3].y:=y; c [4].y:=y;
 c [3].r:=r; c [4].r:=rr;

 ans:=0;
 for i:=1 to 4 do
 begin
  ok:=true;
  for j:=1 to 4 do
  if i<>j then
   if cross (i,j) then
   begin
    ok:=false;
    break;
   end;
  if ok then inc (ans);
 end;
 writeln (ans);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;

{function gcd(a,b:integer):integer;
begin
if b=0 then gcd:=a
       else gcd:=gcd(b,a mod b);
end;
for k:=1 to n-1 do
 for i:=1 to n-k do
  if a[i]>a[i+1] then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; end;}

var x1,y1,x2,y2,r1,r2,rt1,rt2,ans:integer;
    dist:real;

begin
readln(x1,y1,r1,rt1);
readln(x2,y2,r2,rt2);
dist:=sqrt(sqr(x1-x2)+sqr(y1-y2));
                                ans:=0;
if (dist+rt1<=r2) or (dist+rt2<=r1) or (r1+rt2<=dist) then inc(ans);
if (dist+r2<=r1) or (dist+rt1<=r2) or (r2+rt1<=dist) then inc(ans);
if (rt1>=dist+rt2) or (rt1+rt2<=dist) or (dist+rt1<=r2) then inc(ans);
if (rt2>=dist+rt1) or (rt1+rt2<=dist) or (dist+rt2<=r1) then inc(ans);
write(ans);
readln;
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,shk1,shk2:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
    end;
    shk1:=r2-r1;
    shk2:=r4-r3;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if shk1>=cr then begin
        if (r1<=(r3+cr)) and ((r3+cr)<=r2) and (r3>r1) then begin
            o3:=0;
        end;
        if (r1<=(r4+cr)) and ((r4+cr)<=r2) and (r4>r1) then begin
            o4:=0;
        end;
    end;
    if shk2>=cr then begin
        if (r3<=(r1+cr)) and ((r1+cr)<=r4) and (r1>r3) then begin
            o1:=0;
        end;
        if (r3<=(r2+cr)) and ((r2+cr)<=r4) and (r1>r3) then begin
            o2:=0;
        end;
    end;

    writeln(o1+o2+o3+o4);
    (*writeln(o1,o2,o3,o4);*)
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4:longint;
    o1,o2,o3,o4:integer;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
    end;
    writeln(o1+o2+o3+o4);
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,shk1,shk2:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
    end;
    shk1:=r2-r1;
    shk2:=r4-r3;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if shk1>=cr then begin
        if (r1<=(r3+cr)) and ((r3+cr)<=r2) and (r3>r1) then begin
            o3:=0;
        end;
        if (r1<=(r4+cr)) and ((r4+cr)<=r2) and (r4>r1) then begin
            o4:=0;
        end;
    end;
    if shk2>=cr then begin
        if (r3<=(r1+cr)) and ((r1+cr)<=r4) and (r1>r3) then begin
            o1:=0;
        end;
        if (r3<=(r2+cr)) and ((r2+cr)<=r4) and (r2>r3) then begin
            o2:=0;
        end;
    end;

    writeln(o1+o2+o3+o4);
    (*writeln(o1,o2,o3,o4);*)
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,shk1,shk2:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
        (*writeln('t1');*)
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
        (*writeln('t2');*)
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
        (*writeln('t3');*)
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
        (*writeln('t4');*)
    end;
    shk1:=r2-r1;
    shk2:=r4-r3;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if shk1>=cr then begin
        if (r1<=(r3+cr)) and ((r3+cr)<=r2) then begin
            o3:=0;
            (*writeln('tnd1');*)
        end;
        if (r1<=(r4+cr)) and ((r4+cr)<=r2) then begin
            o4:=0;
            (*writeln('tnd2');*)
        end;
    end;
    if shk2>=cr then begin
        if (r3<=(r1+cr)) and ((r1+cr)<=r4) then begin
            o1:=0;
            (*writeln('tnd3');*)
        end;
        if (r3<=(r2+cr)) and ((r2+cr)<=r4) then begin
            o2:=0;
            (*writeln('tnd4');*)
        end;
    end;

    writeln(o1+o2+o3+o4);
    (*writeln(o1,o2,o3,o4);*)
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,shk1,shk2:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
    end;
    shk1:=r2-r1;
    shk2:=r4-r3;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if shk1>=cr then begin
        if (r1<=(r3+cr)) and ((r3+cr)<=r2) and ((r3>r1) or (cr>r1)) then begin
            o3:=0;
        end;
        if (r1<=(r4+cr)) and ((r4+cr)<=r2) and ((r4>r1) or (cr>r1)) then begin
            o4:=0;
        end;
    end;
    if shk2>=cr then begin
        if (r3<=(r1+cr)) and ((r1+cr)<=r4) and ((r1>r3) or (cr>r3)) then begin
            o1:=0;
        end;
        if (r3<=(r2+cr)) and ((r2+cr)<=r4) and ((r2>r3) or (cr>r3)) then begin
            o2:=0;
        end;
    end;

    writeln(o1+o2+o3+o4);
    (*writeln(o1,o2,o3,o4);*)
end.

program ann;
var x1,y1,x2,y2,r1,r2,r3,r4,shk1,shk2:longint;
    o1,o2,o3,o4:integer;
    cr:real;
function per (x1,y1,x2,y2,r1,r2:longint):byte;
var cr:real;
    buf:longint;
begin
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if r1<r2 then begin
        buf:=r1;
        r1:=r2;
        r2:=buf;
    end;
    if (cr<r1) and ((cr+r2)>r1) then per:=0
    else if (cr>=r1) and ((r1+r2)>cr) then per:=0
    else per:=1;
end;

begin
    readln(x1,y1,r1,r2);
    readln(x2,y2,r3,r4);
    o1:=1; o2:=1; o3:=1; o4:=1;
    if per (x1,y1,x2,y2,r1,r3)=0 then begin
        o1:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r1,r4)=0 then begin
        o1:=0;
        o4:=0;
    end;
    if per (x1,y1,x2,y2,r2,r3)=0 then begin
        o2:=0;
        o3:=0;
    end;
    if per (x1,y1,x2,y2,r2,r4)=0 then begin
        o2:=0;
        o4:=0;
    end;
    shk1:=r2-r1;
    shk2:=r4-r3;
    cr:=sqrt(sqr(x1-x2)+sqr(y1-y2));
    if shk1>=cr then begin
        if (r1<(r3+cr)) and ((r3+cr)<r2) then o3:=0;
        if (r1<(r4+cr)) and ((r4+cr)<r2) then o4:=0;
    end;
    if shk2>=cr then begin
        if (r3<(r1+cr)) and ((r1+cr)<r4) then o1:=0;
        if (r3<(r2+cr)) and ((r2+cr)<r4) then o2:=0;
    end;

    writeln(o1+o2+o3+o4);
end.

uses math;

Var x1,y1,x2,y2,r1,rr1,r2,rr2:longint;
    k1,k2,k3,k4:longint;
    kil:longint;

Function ask(x1,y1,r1,x2,y2,r2:longint):longint;

Begin

ask:=1;

if sqr(x1-x2)+sqr(y1-y2)>=sqr(r1+r2) then ask:=0;

if sqr(x1-x2)+sqr(y1-y2)<=sqr(r1-r2) then ask:=0;

end;

Begin

Readln(x1,y1,r1,rr1);
Readln(x2,y2,r2,rr2); k1:=0; k2:=0; k3:=0; k4:=0;

kil:=4;

if (x1=y1)and(x2=y2) then begin

if (r1=r2)or(r1=rr2) then dec(kil);
if (rr1=r2)or(rr1=rr2) then dec(kil); end;

if kil<4 then begin  Writeln(2); halt; end;

if ask(x1,y1,r1,x2,y2,r2)+ask(x1,y1,r1,x2,y2,rr2)=0 then k1:=1;
if ask(x1,y1,rr1,x2,y2,r2)+ask(x1,y1,rr1,x2,y2,rr2)=0 then k2:=1;
if ask(x2,y2,r2,x1,y1,r1)+ask(x2,y2,r2,x1,y1,rr1)=0 then k3:=1;
if ask(x2,y2,rr2,x1,y1,r1)+ask(x2,y2,rr2,x1,y1,rr1)=0 then k4:=1;

if (x1=x2)and(y1=y2)and(r1=r2) then if k1+k3=2 then k1:=0;
if (x1=x2)and(y1=y2)and(r1=rr2) then if k1+k4=2 then k1:=0;
if (x1=x2)and(y1=y2)and(rr1=r2) then if k2+k3=2 then k2:=0;
if (x1=x2)and(y1=y2)and(rr1=rr2) then if k2+k4=2 then k2:=0;

Writeln(k1+k2+k3+k4);

ENd.

uses math;

Var x1,y1,x2,y2,r1,rr1,r2,rr2:longint;
    k1,k2,k3,k4:longint;

Function ask(x1,y1,r1,x2,y2,r2:longint):longint;

Begin

ask:=1;

if sqr(x1-x2)+sqr(y1-y2)>=sqr(r1+r2) then ask:=0;

if sqr(x1-x2)+sqr(y1-y2)<=sqr(abs(r1-r2)) then ask:=0;

end;

Begin

Readln(x1,y1,r1,rr1);
Readln(x2,y2,r2,rr2); k1:=0; k2:=0; k3:=0; k4:=0;

if ask(x1,y1,r1,x2,y2,r2)+ask(x1,y1,r1,x2,y2,rr2)=0 then k1:=1;
if ask(x1,y1,rr1,x2,y2,r2)+ask(x1,y1,rr1,x2,y2,rr2)=0 then k2:=1;
if ask(x2,y2,r2,x1,y1,r1)+ask(x2,y2,r2,x1,y1,rr1)=0 then k3:=1;
if ask(x2,y2,rr2,x1,y1,r1)+ask(x2,y2,rr2,x1,y1,rr1)=0 then k4:=1;

if (x1=x2)and(y1=y2)and(r1=r2) then if k1+k3=2 then k1:=0;
if (x1=x2)and(y1=y2)and(r1=rr2) then if k1+k4=2 then k1:=0;
if (x1=x2)and(y1=y2)and(rr1=r2) then if k2+k3=2 then k2:=0;
if (x1=x2)and(y1=y2)and(rr1=rr2) then if k2+k4=2 then k2:=0;

Writeln(k1+k2+k3+k4);

ENd.

// buneng CE!
var
        len,x1,y1,x2,y2:double;
        r1,r11,r2,r22:longint;
        ans:longint;
        b:array[0..100]of longint;

begin

        readln(x1,y1,r1,r11);
        readln(x2,y2,r2,r22);
        fillchar(b,sizeof(b),0);
        len:=sqrt(sqr(x1-x2)+sqr(y1-y2));
        ans:=0;
        if (len-r1)>0 then
        begin
        if ((len-r1)>=r22)or((len+r1)<=r2)and(b[r1]=0) then
        begin
                inc(ans);
                b[r1]:=1;
        end;
        end
        else
        begin
                if (r22<=(r1-len))or((len+r1)<=r2)and(b[r1]=0) then
                begin
                inc(ans);
                b[r1]:=1;
                end;
        end;
        if (len-r11)>0 then
        begin
        if ((len-r11)>=r22)or((len+r11)<=r2)and(b[r11]=0) then
        begin
                inc(ans);
                b[r11]:=1;
        end;
        end
        else
        begin
                if (r22<=(r11-len))or((len+r11)<=r2)and(b[r11]=0) then
                begin
                inc(ans);
                b[r11]:=1;
        end;
        end;
        if (len-r2)>0 then
        begin
        if ((len-r2)>=r11)or((len+r2)<=r1)and(b[r2]=0) then
        begin
                inc(ans);
                b[r2]:=1;
        end;
        end
        else
        begin
                if (r11<=(r2-len))or((len+r2)<=r1)and(b[r2]=0) then
                begin
                inc(ans);
                b[r2]:=1;
        end;
        end;
        if (len-r22)>0 then
        begin
        if ((len-r22)>=r11)or((len+r22)<=r1)and(b[r22]=0) then
        begin
                inc(ans);
                b[r22]:=1;
        end;
        end
        else
        begin
                if (r11<=(r2-len))or((len+r22)<=r1)and(b[r22]=0) then
                begin
                inc(ans);
                b[r22]:=1;
        end;
        end;
        writeln(ans);

end.

// buneng CE!
var
        len,x1,y1,x2,y2,r1,r11,r2,r22:double;
        ans:longint;

begin

        readln(x1,y1,r1,r11);
        readln(x2,y2,r2,r22);
        len:=sqrt(sqr(x1-x2)+sqr(y1-y2));
        ans:=0;
        if (len-r1)>0 then
        begin
        if ((len-r1)>=r22)or((len+r1)<=r2) then inc(ans);
        end
        else
        begin
                if (r22<=(r1-len))or((len+r1)<=r2) then inc(ans);
        end;
        if (len-r11)>0 then
        begin
        if ((len-r11)>=r22)or((len+r11)<=r2) then inc(ans);
        end
        else
        begin
                if (r22<=(r11-len))or((len+r11)<=r2) then inc(ans);
        end;
        if (len-r2)>0 then
        begin
        if ((len-r2)>=r11)or((len+r2)<=r1) then inc(ans);
        end
        else
        begin
                if (r11<=(r2-len))or((len+r2)<=r1) then inc(ans);
        end;
        if (len-r22)>0 then
        begin
        if ((len-r22)>=r11)or((len+r22)<=r1) then inc(ans);
        end
        else
        begin
                if (r11<=(r2-len))or((len+r22)<=r1) then inc(ans);
        end;
        writeln(ans);

end.

program cf199B;
uses math;
var i,j,br:longint;
    x,y,r:array[0..10] of longint;
    isecen:array[0..10] of boolean;
    rij:real;
    moze:boolean;
function rastojanje(i,j:longint):real;
        begin
        rastojanje:=sqrt(sqr(x[i]-x[j])+sqr(y[i]-y[j]));
        end;
begin
read(x[1],y[1],r[1],r[2]);
x[2]:=x[1];
y[2]:=y[1];
read(x[3],y[3],r[3],r[4]);
x[4]:=x[3];
y[4]:=y[3];

br:=0;

for i:=1 to 4 do
begin
moze:=true;
for j:=1 to 4 do
        begin
        if (i=j) or (isecen[i]) or (isecen[j]) then continue;
        rij:=rastojanje(i,j);
        if rij=0 then continue;
        if rij>=r[i]+r[j] then
                begin
                end
        else
                if rij+min(r[i],r[j])<=max(r[i],r[j]) then
                        begin
                        end
                else
                        moze:=false;
        end;
if moze then
        begin
        isecen[i]:=true;
        inc(br);
        end;
end;
writeln(br);

end.

var
  x1,x2,y1,y2,p1,q1,p2,q2,ans:longint;
  d:real;
  s1,s2,s3,s4:boolean;
begin
  readln(x1,y1,p1,q1);
  readln(x2,y2,p2,q2);
  ans:=0;
  d:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  s1:=false; s2:=false; s3:=false; s4:=false;
  if (d>=p1+p2)or(d<=abs(p1-p2)) then s1:=true;
  if (d>=p1+q2)or(d<=abs(p1-q2)) then s2:=true;
  if (d>=q1+p2)or(d<=abs(q1-p2)) then s3:=true;
  if (d>=q1+q2)or(d<=abs(q1-q2)) then s4:=true;
  if s1 and s2 then inc(ans);
  if s3 and s4 then inc(ans);
  if s1 and s3 then inc(ans);
  if s2 and s4 then inc(ans);
  writeln(ans);
end.

program problemB;
var
 ans,i,j:longint;
 x,y:array[1..2]of longint;
 r:array[1..2,1..2]of longint;

function minn(a,b:longint):longint;
begin
 if a<b then minn:=a else minn:=b;
end;

function check1(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,1]) then exit(true);
 if dist<=minn(sqr(r[3-p,2]-r[p,1]),sqr(r[3-p,1]-r[p,1])) then exit(true);
 exit(false);
end;

function check2(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,2]) then exit(true);
 if dist<=minn(sqr(r[3-p,2]-r[p,2]),sqr(r[3-p,1]-r[p,2])) then exit(true);
 exit(false);
end;

begin
{$ifndef ONLINE_JUDGE}
 assign(input,'B.in');
 reset(input);
 assign(output,'B.out');
 rewrite(output);
{$endif}

 readln(x[1],y[1],r[1,1],r[1,2]);
 readln(x[2],y[2],r[2,1],r[2,2]);

 ans:=0;
 if check1(1) then inc(ans);
 if check2(1) then inc(ans);
 if check1(2) then inc(ans);
 if check2(2) then inc(ans);
 writeln(ans);
end.

program problemB;
var
 dist:double;
 ans,i,j,x1,y1,x2,y2,r11,r12,r21,r22:longint;

function check(x1,y1,r1,x2,y2,r2:longint):boolean;
begin
 dist:=sqrt(sqr(x1-x2)+sqr(y1-y2));
 if dist>=r1+r2 then exit(true);
 if dist<=abs(r1-r2) then exit(true);
 exit(false);
end;

begin
{$ifndef ONLINE_JUDGE}
 assign(input,'B.in');
 reset(input);
 assign(output,'B.out');
 rewrite(output);
{$endif}

 readln(x1,y1,r11,r12);
 readln(x2,y2,r21,r22);

 ans:=0;
 if check(x1,y1,r11,x2,y2,r21) and check(x1,y1,r11,x2,y2,r22) then inc(ans);
 if check(x1,y1,r12,x2,y2,r21) and check(x1,y1,r12,x2,y2,r22) then inc(ans);
 if check(x2,y2,r21,x1,y1,r11) and check(x2,y2,r21,x1,y1,r12) then inc(ans);
 if check(x2,y2,r22,x1,y1,r11) and check(x2,y2,r22,x1,y1,r12) then inc(ans);
 writeln(ans);
end.

program problemB;
var
 ans,i,j:longint;
 x,y:array[1..2]of longint;
 r:array[1..2,1..2]of longint;

function minn(a,b:longint):longint;
begin
 if a<b then minn:=a else minn:=b;
end;

function check1(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,1]) then exit(true);
 if (r[3-p,1]>r[p,1])and(dist<=sqr(r[3-p,1]-r[p,1])) then exit(true);
 exit(false);
end;

function check2(p:longint):boolean;
var
 dist:longint;
begin
 dist:=sqr(x[1]-x[2])+sqr(y[1]-y[2]);
 if dist>=sqr(r[3-p,2]+r[p,2]) then exit(true);
 if (r[3-p,1]>r[p,2])and(dist<=sqr(r[3-p,1]-r[p,2])) then exit(true);
 exit(false);
end;

begin
{$ifndef ONLINE_JUDGE}
 assign(input,'B.in');
 reset(input);
 assign(output,'B.out');
 rewrite(output);
{$endif}

 readln(x[1],y[1],r[1,1],r[1,2]);
 readln(x[2],y[2],r[2,1],r[2,2]);

 ans:=0;
 if check1(1) then inc(ans);
 if check2(1) then inc(ans);
 if check1(2) then inc(ans);
 if check2(2) then inc(ans);
 writeln(ans);
end.

program problemB;
var
 ans,i,j,x1,y1,x2,y2,dist:longint;
 r11,r12,r21,r22:longint;

function check(x1,y1,r1,x2,y2,r2:longint):boolean;
begin
 dist:=sqr(x1-x2)+sqr(y1-y2);
 if dist-sqr(r1+r2)>=0 then exit(true);
 if sqr(r1-r2)-dist>=0 then exit(true);
 exit(false);
end;

begin
{$ifndef ONLINE_JUDGE}
 assign(input,'B.in');
 reset(input);
 assign(output,'B.out');
 rewrite(output);
{$endif}

 readln(x1,y1,r11,r12);
 readln(x2,y2,r21,r22);

 ans:=0;
 if check(x1,y1,r11,x2,y2,r21) and check(x1,y1,r11,x2,y2,r22) then inc(ans);
 if check(x1,y1,r12,x2,y2,r21) and check(x1,y1,r12,x2,y2,r22) then inc(ans);
 if check(x2,y2,r21,x1,y1,r11) and check(x2,y2,r21,x1,y1,r12) then inc(ans);
 if check(x2,y2,r22,x1,y1,r11) and check(x2,y2,r22,x1,y1,r12) then inc(ans);
 writeln(ans);
end.

{$r-,q-,s-,i-,o+}
var
  x,y,r:array[0..500]of longint;
  i,j,res:longint;

  function cross(x1,y1,r1,x2,y2,r2:longint):boolean;
    begin
      if ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)>=(r1+r2)*(r1+r2))then begin
        cross:=false;
        exit;
      end;
      if ((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)<=(r1-r2)*(r1-r2))then begin
        cross:=false;
        exit;
      end;
      cross:=true;
    end;

begin
  read(x[1],y[1],r[1],r[2]);
  x[2]:=x[1];y[2]:=y[1];
  read(x[3],y[3],r[3],r[4]);
  x[4]:=x[3];y[4]:=y[3];
  res:=0;
  for i:=1 to 4 do begin
    inc(res);
    for j:=1 to 4 do
      if (cross(x[i],y[i],r[i],x[j],y[j],r[j]))then begin
        dec(res);
        break;
      end;
  end;
  writeln(res);
end.

const maxn=5;
type cir = record
x,y,r:longint;
end;

var f1,f2:text;
A:array[1..maxn] of cir;
x1,y1,r1,r2,i,j:longint;
res:longint;
d:double;
ok:boolean;
begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,x1,y1,r1,r2);
        A[1].x:=x1;a[1].y:=y1;a[1].r:=r1;
        A[2].x:=x1;a[2].y:=y1;a[2].r:=r2;
        readln(f1,x1,y1,r1,r2);
        A[3].x:=x1;a[3].y:=y1;a[3].r:=r1;
        A[4].x:=x1;a[4].y:=y1;a[4].r:=r2;
        For i:=1 to 4 do
        Begin
          ok:=true;
        for j:=1 to 4 do
        if i<>j then
        begin
          d:=sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x);
          if sqr(a[i].r+a[j].r)<=d then else
          if sqr(ABS(a[i].r-a[j].r))>=d then else
          ok:=false;
        end;
          if ok then inc(res);
        End;
        writeln(f2,res);
        close(f1);
        close(f2);
end.

const maxn=5;
type cir = record
x,y,r:longint;
end;

var f1,f2:text;
A:array[1..maxn] of cir;
C:array[1..maxn] of longint;
x1,y1,r1,r2,i,j:longint;
res:longint;
d:double;
ok:boolean;
d1,d2:longint;
begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,x1,y1,r1,r2);
        A[1].x:=x1;a[1].y:=y1;a[1].r:=r1;
        A[2].x:=x1;a[2].y:=y1;a[2].r:=r2;
        readln(f1,x1,y1,r1,r2);
        A[3].x:=x1;a[3].y:=y1;a[3].r:=r1;
        A[4].x:=x1;a[4].y:=y1;a[4].r:=r2;
        For i:=1 to 2 do
        Begin
          ok:=true;
          for j:=3 to 4 do
          begin
            d:=sqrt(sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x));
            if a[i].r+a[j].r<=d then C[j]:=1 else
            if a[i].r-a[j].r>=d then C[j]:=1 else
            if a[i].r-a[j].r<=d then C[j]:=2 else
            ok:=false;
          end;
          if ok and (C[3]=C[4]) then inc(res);
        End;
        For i:=3 to 4 do
        Begin
          ok:=true;
          for j:=1 to 2 do
          begin
            d:=sqrt(sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x));
            if a[i].r+a[j].r<=d then C[j]:=1 else
            if a[i].r-a[j].r>=d then C[j]:=1 else
            if a[i].r-a[j].r<=d then C[j]:=2 else
            ok:=false;
          end;
          if ok and (C[1]=C[2]) then inc(res);
        End;
        writeln(f2,res);
        close(f1);
        close(f2);
end.

const maxn=5;
type cir = record
x,y,r:longint;
end;

var f1,f2:text;
A:array[1..maxn] of cir;
C:array[1..maxn] of longint;
x1,y1,r1,r2,i,j:longint;
res:longint;
d:double;
ok:boolean;
d1,d2:longint;
begin
        assign(f1,'');reset(f1);
        assign(f2,'');rewrite(f2);
        readln(f1,x1,y1,r1,r2);
        A[1].x:=x1;a[1].y:=y1;a[1].r:=r1;
        A[2].x:=x1;a[2].y:=y1;a[2].r:=r2;
        readln(f1,x1,y1,r1,r2);
        A[3].x:=x1;a[3].y:=y1;a[3].r:=r1;
        A[4].x:=x1;a[4].y:=y1;a[4].r:=r2;
        For i:=1 to 2 do
        Begin
          ok:=true;
          for j:=3 to 4 do
          begin
            d:=sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x);
            if sqr(a[i].r+a[j].r)<=d then C[j]:=1 else
            if sqr(ABS(a[i].r-a[j].r))>=d then C[j]:=2 else
            ok:=false;
          end;
          if ok and (C[3]=C[4]) then inc(res);
        End;
        For i:=3 to 4 do
        Begin
          ok:=true;
          for j:=1 to 2 do
          begin
            d:=sqr(a[i].y-a[j].y)+sqr(a[i].x-a[j].x);
            if sqr(a[i].r+a[j].r)<=d then C[j]:=1 else
            if sqr(ABS(a[i].r-a[j].r))>=d then C[j]:=2 else
            ok:=false;
          end;
          if ok and (C[1]=C[2]) then inc(res);
        End;
        writeln(f2,res);
        close(f1);
        close(f2);
end.

const fi='';
type hkr=record x,y,r:shortint end;
var a,b,c,d,kq:shortint;
    cir1,cir2,cir3,cir4:hkr;
    b1,b2,b3,b4:boolean;
    dis:real; f:text;
function sth(a,b:hkr):shortint; //-1=in 0=inter 1=out 7=touch
begin
     if (abs(a.r-b.r)<dis) and (dis<a.r+b.r) then exit(0);
     if dis>a.r+b.r then exit(1);
     if dis<abs(a.r-b.r) then exit(-1);
     exit(7);
end;
function NI(a,b,c:hkr):boolean;
var stt1,stt2:shortint;
begin
     stt1:=sth(a,b); stt2:=sth(a,c);
     if (stt1=0) or (stt2=0) then exit(false);
     if (stt1+stt2=0) or (stt1+stt2=14) then exit(false);
     exit(true);
end;
begin
     assign(f,fi);reset(f);
     readln(f,a,b,c,d);
     with cir1 do begin x:=a; y:=b; r:=c; end;
     with cir2 do begin x:=a; y:=b; r:=d; end;
     readln(f,a,b,c,d);
     with cir3 do begin x:=a; y:=b; r:=c; end;
     with cir4 do begin x:=a; y:=b; r:=d; end;
     close(f);
     dis:=sqrt(sqr(cir1.x-cir3.x)+sqr(cir1.y-cir3.y));
     b1:=NI(cir1,cir3,cir4);
     b2:=NI(cir2,cir3,cir4);
     b3:=NI(cir3,cir1,cir2);
     b4:=NI(cir4,cir1,cir2);
     if b1 then inc(kq);
     if b2 then inc(kq);
     if b3 then inc(kq);
     if b4 then inc(kq);
     writeln(kq);
end.

type hkr=record x,y,r:shortint end;
var a,b,c,d,kq:shortint;
    cir1,cir2,cir3,cir4:hkr;
    b1,b2,b3,b4:boolean;
function NI(a,b:hkr):boolean;
var d:real;
begin
     d:=sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
     if (abs(a.r-b.r)<d) and (d<a.r+b.r) then exit(false);
     exit(true);
end;
begin
     readln(a,b,c,d);
     with cir1 do begin x:=a; y:=b; r:=c; end;
     with cir2 do begin x:=a; y:=b; r:=d; end;
     readln(a,b,c,d);
     with cir3 do begin x:=a; y:=b; r:=c; end;
     with cir4 do begin x:=a; y:=b; r:=d; end;
     b1:=NI(cir1,cir3);
     b2:=NI(cir1,cir4);
     b3:=NI(cir2,cir3);
     b4:=NI(cir2,cir4);
     if b1 and b2 then inc(kq);
     if b3 and b4 then inc(kq);
     if b1 and b3 then inc(kq);
     if b2 and b4 then inc(kq);
     writeln(kq);
end.

const fi='';
type hkr=record x,y,r:shortint end;
var a,b,c,d,kq:shortint;
    cir1,cir2,cir3,cir4:hkr;
    b1,b2,b3,b4:boolean;
    dis:real; f:text;
function sth(a,b:hkr):shortint; //-1=in 0=inter 1=out 7=touch
begin
     if (abs(a.r-b.r)<dis) and (dis<a.r+b.r) then exit(0);
     if (dis>a.r+b.r) or (dis<a.r-b.r) then exit(1);
     if dis<b.r-a.r then exit(-1);
     exit(7);
end;
function NI(a,b,c:hkr):boolean;
var stt1,stt2:shortint;
begin
     stt1:=sth(a,b); stt2:=sth(a,c);
     if (stt1=0) or (stt2=0) then exit(false);
     if (stt1+stt2=0) or (stt1+stt2=14) then exit(false);
     exit(true);
end;
begin
     assign(f,fi);reset(f);
     readln(f,a,b,c,d);
     with cir1 do begin x:=a; y:=b; r:=c; end;
     with cir2 do begin x:=a; y:=b; r:=d; end;
     readln(f,a,b,c,d);
     with cir3 do begin x:=a; y:=b; r:=c; end;
     with cir4 do begin x:=a; y:=b; r:=d; end;
     close(f);
     dis:=sqrt(sqr(cir1.x-cir3.x)+sqr(cir1.y-cir3.y));
     b1:=NI(cir1,cir3,cir4);
     b2:=NI(cir2,cir3,cir4);
     b3:=NI(cir3,cir1,cir2);
     b4:=NI(cir4,cir1,cir2);
     if b1 then inc(kq);
     if b2 then inc(kq);
     if b3 then inc(kq);
     if b4 then inc(kq);
     writeln(kq);
end.

var x1,y1,x2,y2,r1,r2,r3,r4:longint;
    ans:longint;
function jiao(x1,y1,r1,x2,y2,r2:longint):boolean;
  var t:longint;
  begin
  t:=sqr(x1-x2)+sqr(y1-y2);
  jiao:=(t<sqr(r1+r2)) and (t>sqr(r1-r2));
  end;
function init(x1,y1,r1,r2,x2,y2,r3:longint):boolean;
  var t:longint;
  begin
  t:=sqr(x1-x2)+sqr(y1-y2);
  init:=(r3*2<=abs(r1-r2)) and (t>sqr(r1)) and (t<sqr(r2)) and
  not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y2,r2,x2,y2,r3);
  end;
begin
  readln(x1,y1,r1,r2);
  readln(x2,y2,r3,r4);
  ans:=0;
  if not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y1,r1,x2,y2,r4)
  and not init(x2,y2,r3,r4,x1,y1,r1)then
    inc(ans);
//  writeln(ans);
  if not jiao(x1,y1,r2,x2,y2,r3) and not jiao(x1,y1,r2,x2,y2,r4)
    and not init(x2,y2,r3,r4,x1,y1,r2)then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r3,x1,y1,r1) and not jiao(x2,y2,r3,x1,y1,r2)
    and not init(x1,y1,r1,r2,x2,y2,r3) then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r4,x1,y1,r1) and not jiao(x2,y2,r4,x1,y1,r2)
    and not init(x1,y1,r1,r2,x2,y2,r4) then
    inc(ans);
//  writeln(ans);
  writeln(ans);
end.

var x1,y1,x2,y2,r1,r2,r3,r4:longint;
    ans:longint;
function jiao(x1,y1,r1,x2,y2,r2:longint):boolean;
  var t:longint;
  begin
  t:=sqr(x1-x2)+sqr(y1-y2);
  jiao:=(t<sqr(r1+r2)) and (t>sqr(r1-r2));
  end;
begin
  readln(x1,y1,r1,r2);
  readln(x2,y2,r3,r4);
  ans:=0;
  if not jiao(x1,y1,r1,x2,y2,r3) and not jiao(x1,y1,r1,x2,y2,r4) then
    inc(ans);
//  writeln(ans);
  if not jiao(x1,y1,r2,x2,y2,r3) and not jiao(x1,y1,r2,x2,y2,r4) then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r3,x1,y1,r1) and not jiao(x2,y2,r3,x1,y1,r2) then
    inc(ans);
//  writeln(ans);
  if not jiao(x2,y2,r4,x1,y1,r1) and not jiao(x2,y2,r4,x1,y1,r2) then
    inc(ans);
//  writeln(ans);
  writeln(ans);
end.

const
    eps=0;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2) then begin
         if (b1<a2) then begin
             writeln(4);exit;
         end;
         if (b2<a1) then begin
             writeln(4);exit;
         end;
         writeln(2);exit;
    end;
    if (-a1-eps<len-b2)and(len+b2<a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-a1)and(a1<len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<len-b2)and(len+b2<b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-b1)and(b1<len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<len-b1)and(len+b1<a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-a2)and(a2<len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<len-b1)and(len+b1<b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-b2)and(b2<len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if (((z-x)*abs(z-x)<=ll)and(ll<=(x-z)*(x-z)))or(len>=(x+z)*(x+z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<=ll)and(ll<=(x-y)*(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if (((z-x)*abs(z-x)<=ll)and(ll<=(x-z)*abs(x-z)))or(len>=(x+z)*(x+z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<=ll)and(ll<=(x-y)*abs(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if ((z-x)*abs(z-x)<ll)and(ll<(x-z)*(x-z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<=ll)and(ll<=(x-y)*(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (-a1-eps<=len-b2)and(len+b2<=a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<=-a1)and(a1<=len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<=len-b2)and(len+b2<=b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<=-b1)and(b1<=len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<=len-b1)and(len+b1<=a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<=-a2)and(a2<=len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<=len-b1)and(len+b1<=b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<=-b2)and(b2<=len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2) then begin
         if (b1<a2) then begin
             writeln(4);exit;
         end;
         if (b2<a1) then begin
             writeln(4);exit;
         end;
         writeln(2);exit;
    end;
    if (-a1-eps<len-b2)and(len+b2<a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-a1)and(a1<len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<len-b2)and(len+b2<b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-b1)and(b1<len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<len-b1)and(len+b1<a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-a2)and(a2<len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<len-b1)and(len+b1<b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-b2)and(b2<len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (-a1<=len-b2)and(len+b2<=a1) then begin
       inc(n);
    end;
    if (len-a2<=-a1)and(a1<=len+a2) then begin
       inc(n);
    end;
    if (-b1<=len-b2)and(len+b2<=b1) then begin
       inc(n);
    end;
    if (len-a2<=-b1)and(b1<=len+a2) then begin
       inc(n);
    end;
    if (-a2<=len-b1)and(len+b1<=a2) then begin
       inc(n);
    end;
    if (len-a1<=-a2)and(a2<=len+a1) then begin
       inc(n);
    end;
    if (-b2<=len-b1)and(len+b1<=b2) then begin
       inc(n);
    end;
    if (len-a1<=-b2)and(b2<=len+a1) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-10;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2) then begin
         if (b1<a2) then begin
             writeln(4);exit;
         end;
         if (b2<a1) then begin
             writeln(4);exit;
         end;
         writeln(2);exit;
    end;
    if (-a1-eps<len-b2)and(len+b2<a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-a1)and(a1<len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<len-b2)and(len+b2<b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-b1)and(b1<len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<len-b1)and(len+b1<a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-a2)and(a2<len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<len-b1)and(len+b1<b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-b2)and(b2<len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if ((z-x)*abs(z-x)<=ll)and(ll<=(x-z)*(x-z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<=ll)and(ll<=(x-y)*(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    if (-a1-eps<len-b2)and(len+b2<a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-a1)and(a1<len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<len-b2)and(len+b2<b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-b1)and(b1<len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<len-b1)and(len+b1<a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-a2)and(a2<len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<len-b1)and(len+b1<b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-b2)and(b2<len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:extended;
    n:longint;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    if (-a1-eps<len-b2)and(len+b2<a1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-a1)and(a1<len+a2+eps) then begin
       inc(n);
    end;
    if (-b1-eps<len-b2)and(len+b2<b1+eps) then begin
       inc(n);
    end;
    if (len-a2-eps<-b1)and(b1<len+a2+eps) then begin
       inc(n);
    end;
    if (-a2-eps<len-b1)and(len+b1<a2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-a2)and(a2<len+a1+eps) then begin
       inc(n);
    end;
    if (-b2-eps<len-b1)and(len+b1<b2+eps) then begin
       inc(n);
    end;
    if (len-a1-eps<-b2)and(b2<len+a1+eps) then begin
       inc(n);
    end;
    writeln(n);
end.

const
    eps=1e-9;
var
    x1,y1,a1,b1:longint;
    x2,y2,a2,b2:longint;
    len:longint;
    n:longint;

    function sum(x,y,z,ll:longint):longint;
    var k:longint;
    begin
        k:=0;
        if (((z-x)*abs(z-x)<ll)and(ll<(x-z)*(x-z)))or(len>(x+z)*(x+z)) then begin
             k:=1;
        end;
        if ((x-y)*abs(x-y)<ll)and(ll<(x-y)*(x-y)) then begin
             k:=k+1;
        end;
        sum:=k;
    end;

begin
    readln(x1,y1,a1,b1);
    readln(x2,y2,a2,b2);
    len:=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    if (x1=x2)and(y1=y2)and(a1=a2)and(b1=b2) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(a2=b1) then begin
         writeln(2);exit;
    end;
    if (x1=x2)and(y1=y2)and(b2=a1) then begin
         writeln(2);exit;
    end;
    n:=0;
    n:=n+sum(a1,a2,b2,len);
    n:=n+sum(b1,a2,b2,len);
    n:=n+sum(a2,a1,b1,len);
    n:=n+sum(b2,a1,b1,len);
    writeln(n);
end.

type
 ongint=extended;
var x1,y1,x2,y2,i1,o1,i2,o2:ongint;
    ans:longint;

 procedure check(x,y,r,x1,y1,i1,o1:ongint);

  function f(x,y,r,x1,y1,r1:ongint):boolean;
   var d:ongint;

    procedure swap(var a,b:ongint);
     var c:ongint;
      begin
       c:=a; a:=b; b:=c;
      end;

   begin
    if r<r1 then
     begin
      swap(x,x1);
      swap(y,y1);
      swap(r,r1);
     end;
    d:=sqrt(sqr(x-x1)+sqr(y-y1));
    if d<r then
     begin
      if d+r1>r then exit(true) else exit(false);
     end;
    if d=r then exit(false);
    if r+r1<d then exit(false);
    exit(true);
   end;

   begin
     if (f(x,y,r,x1,y1,i1)) or (f(x,y,r,x1,y1,o1)) then exit;
     inc(ans);
    end;

 begin
  readln(x1,y1,i1,o1);
  readln(x2,y2,i2,o2);
  check(x1,y1,i1,x2,y2,i2,o2);
  check(x1,y1,o1,x2,y2,i2,o2);
  check(x2,y2,i2,x1,y1,i1,o1);
  check(x2,y2,o2,x1,y1,i1,o1);
  write(ans);
 end.

type
 cir=record
  x,y,r:longint;
 end;
var
 c1,c2,c3,c4:cir;
 tot,i,j,k,x,y:longint;
function inter(o,a,b:cir):boolean;
 var
  i,j,k:longint;
  dis:real;
 begin
  dis:=sqrt(sqr(o.x-a.x)+sqr(o.y-a.y));
  if (dis>abs(o.r-a.r))and(dis<o.r+a.r) then exit(true);
  if (dis>abs(o.r-b.r))and(dis<o.r+b.r) then exit(true);
  if (o.r>a.r)and(dis<abs(o.r-a.r))and(dis<abs(o.r-b.r))and(o.r<b.r) then exit(true);
  if (dis>o.r+a.r)and(o.r<b.r)and(dis<abs(o.r-b.r)) then exit(true);
  exit(false);
 end;
begin
 read(x,y);
 c1.x:=x;c2.x:=x;c1.y:=y;c2.y:=y;
 readln(c1.r,c2.r);
 read(x,y);
 c3.x:=x;c4.x:=x;c3.y:=y;c4.y:=y;
 readln(c3.r,c4.r);
 tot:=0;
 if not inter(c1,c3,c4) then inc(tot);
 if not inter(c2,c3,c4) then inc(tot);
 if not inter(c3,c1,c2) then inc(tot);
 if not inter(c4,c1,c2) then inc(tot);
 writeln(tot);
end.

type
 cir=record
  x,y,r:longint;
 end;
var
 c1,c2,c3,c4:cir;
 tot,i,j,k,x,y:longint;
function inter(o,a,b:cir):boolean;
 var
  i,j,k:longint;
  dis:real;
 begin
  dis:=sqrt(sqr(o.x-a.x)+sqr(o.y-a.y));
  if (dis>abs(o.r-a.r))and(dis<o.r+a.r) then exit(true);
  if (dis>abs(o.r-b.r))and(dis<o.r+b.r) then exit(true);
  if (o.r>a.r)and(dis<abs(o.r-a.r))and(o.r<b.r) then exit(true);
  exit(false);
 end;
begin
 read(x,y);
 c1.x:=x;c2.x:=x;c1.y:=y;c2.y:=y;
 readln(c1.r,c2.r);
 read(x,y);
 c3.x:=x;c4.x:=x;c3.y:=y;c4.y:=y;
 readln(c3.r,c4.r);
 tot:=0;
 if not inter(c1,c3,c4) then inc(tot);
 if not inter(c2,c3,c4) then inc(tot);
 if not inter(c3,c1,c2) then inc(tot);
 if not inter(c4,c1,c2) then inc(tot);
 writeln(tot);
end.

type
 cir=record
  x,y,r:longint;
 end;
var
 c1,c2,c3,c4:cir;
 tot,i,j,k,x,y:longint;
function inter(o,a,b:cir):boolean;
 var
  i,j,k:longint;
  dis:real;
 begin
  dis:=sqrt(sqr(o.x-a.x)+sqr(o.y-a.y));
  if (dis>abs(o.r-a.r))and(dis<o.r+a.r) then exit(true);
  if (dis>abs(o.r-b.r))and(dis<o.r+b.r) then exit(true);
  exit(false);
 end;
begin
 read(x,y);
 c1.x:=x;c2.x:=x;c1.y:=y;c2.y:=y;
 readln(c1.r,c2.r);
 read(x,y);
 c3.x:=x;c4.x:=x;c3.y:=y;c4.y:=y;
 readln(c3.r,c4.r);
 tot:=0;
 if not inter(c1,c3,c4) then inc(tot);
 if not inter(c2,c3,c4) then inc(tot);
 if not inter(c3,c1,c2) then inc(tot);
 if not inter(c4,c1,c2) then inc(tot);
 writeln(tot);
end.

var x1,y1,r1,rr1,x2,y2,r2,rr2,q:longint;s:extended;
begin
 readln(x1,y1,r1,rr1);
 readln(x2,y2,r2,rr2);
 s:=sqrt(sqr(x1-x2)+sqr(y1-y2));q:=0;
 if (s>=r1+r2)and(s>=r1+rr2)then inc(q);
 if (s<=abs(r1-r2))and(s<=abs(r1-rr2))then inc(q);

 if (s>=rr1+r2)and(s>=rr1+rr2)then inc(q);
 if (s<=abs(rr1-r2))and(s<=abs(rr1-rr2))then inc(q);

 if (s>=r2+r1)and(s>=r2+rr1)then inc(q);
 if (s<=abs(r2-r1))and(s<=abs(r2-rr1))then inc(q);

 if (s>=rr2+r1)and(s>=rr2+rr1)then inc(q);
 if (s<=abs(rr2-r1))and(s<=abs(rr2-rr1))then inc(q);

 if (r1>=s+r2)and(r1<=s+rr2)then dec(q);
 if (rr1>=s+r2)and(rr1<=s+rr2)then dec(q);
 if (r2>=s+r1)and(r2<=s+rr1)then dec(q);
 if (rr2>=s+r1)and(rr2<=s+rr1)then dec(q);
 writeln(q);
end.

var x1,y1,r1,rr1,x2,y2,r2,rr2,q:longint;s:extended;
begin
 readln(x1,y1,r1,rr1);
 readln(x2,y2,r2,rr2);
 s:=sqrt(sqr(x1-x2)+sqr(y1-y2));q:=0;
 if (s>=r1+r2)and(s>=r1+rr2)then inc(q);
 if (s<=abs(r1-r2))and(s<=abs(r1-rr2))then inc(q);

 if (s>=rr1+r2)and(s>=rr1+rr2)then inc(q);
 if (s<=abs(rr1-r2))and(s<=abs(rr1-rr2))then inc(q);

 if (s>=r2+r1)and(s>=r2+rr1)then inc(q);
 if (s<=abs(r2-r1))and(s<=abs(r2-rr1))then inc(q);

 if (s>=rr2+r1)and(s>=rr2+rr1)then inc(q);
 if (s<=abs(rr2-r1))and(s<=abs(rr2-rr1))then inc(q);
 writeln(q);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f2=true then
    if (dist<r1+r2)and(r1>r2)and(dist<r1+d2)and(r1<d2) then f2:=false;
  if f4=true then
    if (dist<r1+r2)and(r2>r1)and(dist<r2+d1)and(r2<d1) then f4:=false;
  if f1=true then
    if (dist<r2+d1)and(d1>r2)and(dist<d1+d2)and(d1<d2) then f1:=false;
  if f3=true then
    if (dist<r1+d2)and(d2>r1)and(dist<d1+d2)and(d2<d1) then f3:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2+a1))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1+a2))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f2=true then
    if ((dist<r1+r2)and(r1>r2)and(dist<r1+d2)and(r1<d2))or((dist>r1+r2)and(dist<r1+d2)) then f2:=false;
  if f1=true then
    if ((dist<r2+d1)and(d1>r2)and(dist<d1+d2)and(d1<d2))or((dist>d1+r2)and(dist<d1+d2)) then f1:=false;
  if f4=true then
    if ((dist<r1+r2)and(r2>r1)and(dist<r2+d1)and(r2<d1))or((dist>r1+r2)and(dist<r2+d1)) then f4:=false;
  if f3=true then
    if ((dist<r1+d2)and(d2>r1)and(dist<d1+d2)and(d2<d1))or((dist>d2+r1)and(dist<d2+d1)) then f3:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

program pa;
var
  a,ans:array[1..100001] of longint;
  n1,top,n,i,t:longint;
begin
  //assign(input,'a.in');reset(input);
  //assign(output,'a.out');rewrite(output);
  readln(n);n1:=n;
  a[1]:=0;a[2]:=1;
  i:=2;
  while a[i]<=n do
    begin
      inc(i);
      a[i]:=a[i-1]+a[i-2];
    end;
  top:=i;
  t:=0;
  for i:=top-1 downto 2 do
    while n>=a[i] do
      begin
        inc(t);
        ans[t]:=a[i];
        n:=n-a[i];
      end;
  if (t<=3){and(n1>=2)} then
    writeln(ans[1],' ',ans[2],' ',ans[3])
  else writeln('I',chr(39),'m too stupid to solve this problem');
  //close(input);
  //close(output);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f2=true then
    if ((dist<r1+r2)and(r1>r2)and(dist<r1+d2)and(r1<d2))or((dist>r1+r2)and(dist<r1+d2)) then f2:=false;
  if f4=true then
    if ((dist<r1+r2)and(r2>r1)and(dist<r2+d1)and(r2<d1))or((dist>r1+r2)and(dist<r2+d1)) then f4:=false;
  if f1=true then
    if ((dist<r2+d1)and(d1>r2)and(dist<d1+d2)and(d1<d2))or((dist>d1+r2)and(dist<d1+d2)) then f1:=false;
  if f3=true then
    if ((dist<r1+d2)and(d2>r1)and(dist<d1+d2)and(d2<d1))or((dist>d2+r1)and(dist<d2+d1)) then f3:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2+a1))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1+a2))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f2=true then
    if ((dist<=r1+r2)and(r1>=r2)and(dist<=r1+d2)and(r1<=d2))or((dist>=r1+r2)and(dist<=r1+d2)) then f2:=false;
  if f1=true then
    if ((dist<=r2+d1)and(d1>=r2)and(dist<=d1+d2)and(d1<=d2))or((dist>=d1+r2)and(dist<=d1+d2)) then f1:=false;
  if f4=true then
    if ((dist<=r1+r2)and(r2>=r1)and(dist<=r2+d1)and(r2<=d1))or((dist>=r1+r2)and(dist<=r2+d1)) then f4:=false;
  if f3=true then
    if ((dist<=r1+d2)and(d2>=r1)and(dist<=d1+d2)and(d2<=d1))or((dist>=d2+r1)and(dist<=d2+d1)) then f3:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  if f1=true then
    if (dist<d1+d2)and(d1>d2)and(dist<d1+r2)and(d1<r2) then f1:=false;
  if f3=true then
    if (dist<d1+d2)and(d2>d1)and(dist<d2+r1)and(d2<r1) then f2:=false;
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

program b;
var
  x1,x2,y1,y2,r1,r2,d1,d2:double;
  f1,f2,f3,f4:boolean;
  dist:double;
  tot:longint;
procedure work(a1,a2:double;var fa,fb:boolean);
  begin
    if a1<a2 then
      begin
        if ((dist>a2)and(dist<a1+a2))or((dist+a1>a2)and(dist<a2))
        then  begin fa:=false;fb:=false;end;
      end
    else
      begin
        if ((dist>a1)and(dist<a1+a2))or((dist+a2>a1)and(dist<a1))
          then begin fa:=false;fb:=false;end;
      end
  end;
begin
  //assign(input,'b.in');reset(input);
  //assign(output,'b.out');rewrite(output);
  readln(x1,y1,r1,d1);
  readln(x2,y2,r2,d2);
  dist:=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  f1:=true;f2:=true;f3:=true;f4:=true;
  work(d1,d2,f1,f3);
  work(d1,r2,f1,f4);
  work(r1,d2,f2,f3);
  work(r1,r2,f2,f4);
  tot:=0;
  if f1=true then inc(tot);
  if f2=true then inc(tot);
  if f3=true then inc(tot);
  if f4=true then inc(tot);
  writeln(tot);
  //close(input);
  //close(output);
end.

const   finp='';
        fout='';
var     fi,fo:text;
        x,y,r1,r2:array[1..2]of longint;
procedure enter;
var     i:longint;
begin
        assign(fi,finp);reset(fi);
                for i:=1 to 2 do
                        readln(fi,x[i],y[i],r1[i],r2[i]);
        close(fi);
end;
function scat(x1,x2,y1,y2,r1,r2:longint):longint;
var     t1,t2,t3,t:longint;
begin
        if r1 < r2 then t:=r2
        else t:=r1;
        t1:=sqr(x1-x2)+sqr(y1-y2);
        t2:=sqr(r1+r2);
        t3:=sqr(r1-r2);
        if t1 < sqr(t) then
        begin
                if t1=t3 then
                        exit(1)
                else if t1 < t3 then
                        exit(0)
                else exit(2);
        end
        else
        begin
                if t1=t2 then
                        exit(1)
                else if t1 < t2 then
                        exit(2)
                else exit(0);
        end;
end;
procedure solve;
var     i,j:longint;
        res:longint;
begin
        assign(fo,fout);rewrite(fo);
                res:=0;
                if (scat(x[1],x[2],y[1],y[2],r1[1],r1[2]) <= 1)
                and (scat(x[1],x[2],y[1],y[2],r1[1],r2[2]) <= 1)
                then res:=res+1;
                if (scat(x[1],x[2],y[1],y[2],r2[1],r1[2]) <= 1)
                and (scat(x[1],x[2],y[1],y[2],r2[1],r2[2]) <= 1) then
                        res:=res+1;
                if (scat(x[2],x[1],y[2],y[1],r1[2],r1[1]) <= 1)
                and (scat(x[2],x[1],y[2],y[1],r1[2],r2[1]) <= 1) then
                        res:=res+1;
                if (scat(x[2],x[1],y[2],y[1],r2[2],r1[1]) <= 1)
                and (scat(x[2],x[1],y[2],y[1],r2[2],r2[1]) <= 1) then
                        res:=res+1;
                writeln(fo,res);
        close(fo);
end;
begin
        enter;
        solve;
end.

var x1,y1,x2,y2:shortint; r:array[1..4] of byte; d:real; i,j:byte;
begin
        readln(x1,y1,r[1],r[2]);
        read(x2,y2,r[3],r[4]);
        d:=sqrt(sqr(x1-x2)+sqr(y1-y2)); x1:=0;
        for i:=1 to 2 do
        begin
                y1:=1;
                for j:=3 to 4 do
                if (r[i]+r[j]>d) and (abs(r[i]-r[j])<d) then
                begin
                        y1:=0;
                        break
                end;
                if y1=1 then inc(x1)
        end;
        for i:=3 to 4 do
        begin
                y1:=1;
                for j:=1 to 2 do
                if (r[i]+r[j]>d) and (abs(r[i]-r[j])<d) then
                begin
                        y1:=0;
                        break
                end;
                if y1=1 then inc(x1)
        end;
        write(x1)
end.