#include <bits/stdc++.h>
using namespace std;
double x[2], y[2], R[2], r[2];
double dis(double a, double b, double c, double d) {
  return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
int doit(int flag) {
  double d = dis(x[flag], y[flag], x[!flag], y[!flag]);
  double d1, d2;
  int ans = 0;
  if (r[flag] >= d + R[!flag])
    ans = 2;
  else if (R[flag] >= d + R[!flag])
    ans = 1;
  if (ans == 2) return 2;
  if (d <= R[!flag] && d >= r[!flag]) return ans;
  d1 = abs(R[!flag] - d);
  d2 = abs(r[!flag] - d);
  double dd = min(d1, d2);
  if (ans == 1) {
    if (dd >= r[flag]) ans++;
    return ans;
  } else {
    if (dd >= r[flag]) ans++;
    if (dd >= R[flag]) ans++;
    return ans;
  }
}
int main() {
  for (int i = 0; i < 2; ++i) cin >> x[i] >> y[i] >> r[i] >> R[i];
  int ans = 0;
  ans += doit(0);
  ans += doit(1);
  cout << ans << endl;
  return 0;
}
