#include <bits/stdc++.h>
using namespace std;
int Cross(int x1, int y1, int r1, int x2, int y2, int r2) {
  double dx = x2 - x1;
  double dy = y2 - y1;
  double dr = sqrt(dx * dx + dy * dy);
  if (dr >= r1 + r2) {
    return -1;
  } else {
    if (r1 >= dr + r2) {
      return 1;
    } else if (r2 >= dr + r1) {
      return 2;
    }
  }
  return 0;
}
int main(int argc, char *argv[]) {
  int x1, x2, y1, y2, r11, r12, r21, r22;
  cin >> x1 >> y1 >> r11 >> r12;
  cin >> x2 >> y2 >> r21 >> r22;
  int cross11, cross12, cross21, cross22;
  cross11 = Cross(x1, y1, r11, x2, y2, r21);
  cross12 = Cross(x1, y1, r11, x2, y2, r22);
  cross21 = Cross(x1, y1, r12, x2, y2, r21);
  cross22 = Cross(x1, y1, r12, x2, y2, r22);
  int res = 0;
  if ((cross11 == 2) || (cross12 == 1) || (cross12 == -1)) {
    ++res;
  }
  if ((cross11 == 1) || (cross21 == 2) || (cross21 == -1)) {
    ++res;
  }
  if ((cross21 == 2) || (cross22 == 1) || (cross22 == -1)) {
    ++res;
  }
  if ((cross12 == 1) || (cross22 == 2) || (cross22 == -1)) {
    ++res;
  }
  cout << res << endl;
  return 0;
};
