#include <bits/stdc++.h>
template <class T>
inline T qmin(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T qmax(T a, T b) {
  return a > b ? a : b;
}
const double eps = 1e-7;
const double PI = acos(-1);
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 1;
const int maxn = (int)1e5 + 5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
using namespace std;
inline int sign(double a) { return a < -eps ? -1 : a > eps; }
inline int cmp(double a, double b) { return sign(a - b); }
double dis;
bool cmp(double r, double r1, double R1) {
  return dis + r <= r1 || r + R1 <= dis || dis + R1 <= r;
}
int main() {
  double x1, y1, r1, R1;
  double x2, y2, r2, R2;
  scanf("%lf %lf %lf %lf", &x1, &y1, &r1, &R1);
  scanf("%lf %lf %lf %lf", &x2, &y2, &r2, &R2);
  dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  int ans =
      cmp(r1, r2, R2) + cmp(R1, r2, R2) + cmp(r2, r1, R1) + cmp(R2, r1, R1);
  printf("%d\n", ans);
  return 0;
}
