#include <bits/stdc++.h>
using namespace std;
double distance_sq(double x1, double y1, double x2, double y2) {
  double x3 = x2 - x1, y3 = y2 - y1;
  return ((x3 * x3) + (y3 * y3));
}
int main(void) {
  double x1, y1;
  double x2, y2;
  double r[4];
  while (cin >> x1 >> y1 >> r[0] >> r[1] >> x2 >> y2 >> r[2] >> r[3]) {
    int count = 0;
    double dist = sqrt(distance_sq(x1, y1, x2, y2));
    for (int i = 0; i < 2; ++i) {
      double sub = 0;
      int k = (i + 1) % 2;
      if (dist < r[i * 2]) {
        sub = r[i * 2] - dist;
        for (int j = k * 2; j < k * 2 + 2; ++j) {
          if (sub >= r[j]) ++count;
        }
      } else if (dist < r[i * 2 + 1]) {
        sub = r[i * 2 + 1] - r[i * 2];
      } else {
        sub = dist - r[i * 2 + 1];
        for (int j = k * 2; j < k * 2 + 2; ++j) {
          if (sub >= r[j]) ++count;
        }
      }
      for (int j = k * 2; j < k * 2 + 2; ++j) {
        if (r[i * 2 + 1] + dist <= r[j]) ++count;
      }
    }
    cout << count << endl;
  }
  return 0;
}
