#include <bits/stdc++.h>
using namespace std;
int solve(long double sx, long double sy, long double nx, long double ny,
          long double x, long double y) {
  long double dis = sqrt((sx - nx) * (sx - nx) + (sy - ny) * (sy - ny));
  if (dis >= x + y)
    return 1;
  else if (x + dis <= y)
    return 2;
  else if (y + dis <= x)
    return 3;
  else
    return 4;
}
int cal(long double sx, long double sy, long double a1, long double b1,
        long double nx, long double ny, long double a2, long double b2) {
  int v = solve(sx, sy, nx, ny, b1, b2);
  if (v == 1) {
    return 4;
  }
  if (v == 2) {
    int y = solve(sx, sy, nx, ny, b1, a2);
    if (y == 1) {
      return 2;
    }
    if (y == 2) {
      return 4;
    }
    if (y == 3) {
      int x = solve(sx, sy, nx, ny, a1, a2);
      if (x == 1) return 1;
      if (x == 2) return 2;
      if (x == 3) return 2;
      if (x == 4) return 1;
    }
    if (y == 4) {
      int x = solve(sx, sy, nx, ny, a1, a2);
      if (x == 1) return 1;
      if (x == 2) return 2;
      if (x == 3) return 2;
      if (x == 4) return 1;
    }
  }
  if (v == 3) {
    int y = solve(sx, sy, nx, ny, b2, a1);
    if (y == 1) {
      return 2;
    }
    if (y == 2) {
      return 4;
    }
    if (y == 3) {
      int x = solve(sx, sy, nx, ny, a2, a1);
      if (x == 1) return 1;
      if (x == 2) return 2;
      if (x == 3) return 2;
      if (x == 4) return 1;
    }
    if (y == 4) {
      int x = solve(sx, sy, nx, ny, a2, a1);
      if (x == 1) return 1;
      if (x == 2) return 2;
      if (x == 3) return 2;
      if (x == 4) return 1;
    }
  }
  if (v == 4) {
    int y = solve(sx, sy, nx, ny, b1, a2), num = 0;
    if (y == 1) {
      num++;
    }
    if (y == 3) {
      int x = solve(sx, sy, nx, ny, a1, a2);
      if (x == 3) {
        num++;
      }
    }
    y = solve(sx, sy, nx, ny, b2, a1);
    if (y == 1) {
      num++;
    }
    if (y == 3) {
      int x = solve(sx, sy, nx, ny, a2, a1);
      if (x == 3) {
        num++;
      }
    }
    return num;
  }
  return 0;
}
int main() {
  long double sx, sy, a1, b1, nx, ny, a2, b2;
  cin >> sx >> sy >> a1 >> b1 >> nx >> ny >> a2 >> b2;
  int v = cal(sx, sy, a1, b1, nx, ny, a2, b2);
  cout << v << endl;
}
