#include <bits/stdc++.h>
using namespace std;
const double EP = 1e-8;
struct circle_t {
  double x, y;
  double r;
};
struct point_t {
  double x, y;
};
inline double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
double sqr(double a) { return a * a; }
int circle_intersect(circle_t A, circle_t B, point_t &ia, point_t &ib) {
  if (A.x == B.x && A.y == B.y) return 5;
  double dd = dist(A.x, A.y, B.x, B.y);
  if (A.r + B.r + EP < dd) return 1;
  double k, a, b, d, aa, bb, cc, c, drt;
  k = A.r;
  a = B.x - A.x;
  b = B.y - A.y;
  c = B.r;
  d = sqr(c) - sqr(k) - sqr(a) - sqr(b);
  aa = 4 * sqr(a) + 4 * sqr(b);
  bb = 4 * b * d;
  cc = sqr(d) - 4 * sqr(a) * sqr(k);
  drt = sqr(bb) - 4 * aa * cc;
  if (drt < 0) return 5;
  drt = sqrt(drt);
  ia.y = (-bb + drt) / 2 / aa;
  ib.y = (-bb - drt) / 2 / aa;
  if (abs(a) < EP) {
    ia.x = sqrt(sqr(k) - sqr(ia.y));
    ib.x = -ia.x;
  } else {
    ia.x = (2 * b * ia.y + d) / -2 / a;
    ib.x = (2 * b * ib.y + d) / -2 / a;
  }
  ia.x += A.x;
  ia.y += A.y;
  ib.x += A.x;
  ib.y += A.y;
  if (abs(ia.y - ib.y) < EP) {
    if (abs(A.r + B.r - dd) < EP) return 1;
    if (abs(dd - (max(A.r, B.r) - min(A.r, B.r))) < EP) return 5;
  }
  return 4;
}
int main() {
  circle_t a, b, c, d;
  double x1, y1, r1, R1, x2, y2, r2, R2;
  while (~scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x1, &y1, &r1, &R1, &x2, &y2, &r2,
                &R2)) {
    a.x = x1, a.y = y1, a.r = r1;
    b.x = x1, b.y = y1, b.r = R1;
    c.x = x2, c.y = y2, c.r = r2;
    d.x = x2, d.y = y2, d.r = R2;
    int ans = 0;
    point_t p1, p2;
    if (circle_intersect(a, c, p1, p2) != 4 &&
        circle_intersect(a, d, p1, p2) != 4 &&
        !(circle_intersect(a, d, p1, p2) == 5 &&
          circle_intersect(a, c, p1, p2) == 5 && a.r < d.r && a.r > c.r) &&
        !(circle_intersect(a, d, p1, p2) == 5 &&
          circle_intersect(a, c, p1, p2) == 1)) {
      ans++;
    }
    if (circle_intersect(b, c, p1, p2) != 4 &&
        circle_intersect(b, d, p1, p2) != 4 &&
        !(circle_intersect(b, d, p1, p2) == 5 &&
          circle_intersect(b, c, p1, p2) == 5 && b.r < d.r && b.r > c.r) &&
        !(circle_intersect(b, d, p1, p2) == 5 &&
          circle_intersect(b, c, p1, p2) == 1)) {
      ans++;
    }
    if (circle_intersect(c, a, p1, p2) != 4 &&
        circle_intersect(c, b, p1, p2) != 4 &&
        !(circle_intersect(c, a, p1, p2) == 5 &&
          circle_intersect(c, b, p1, p2) == 5 && c.r < b.r && c.r > a.r) &&
        !(circle_intersect(c, b, p1, p2) == 5 &&
          circle_intersect(c, a, p1, p2) == 1)) {
      ans++;
    }
    if (circle_intersect(d, a, p1, p2) != 4 &&
        circle_intersect(d, b, p1, p2) != 4 &&
        !(circle_intersect(d, a, p1, p2) == 5 &&
          circle_intersect(d, b, p1, p2) == 5 && d.r < b.r && d.r > a.r) &&
        !(circle_intersect(d, b, p1, p2) == 5 &&
          circle_intersect(d, a, p1, p2) == 1)) {
      ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}
