#include <bits/stdc++.h>
using namespace std;
int r[2], R[2], x[2], y[2];
int ans;
void f(int i, int j) {
  int dist = (x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]);
  if (dist >= (r[i] + R[j]) * (r[i] + R[j]))
    ans++;
  else {
    if (r[j] >= r[i] && dist <= (r[j] - r[i]) * (r[j] - r[i]) && R[j] >= r[i] &&
        dist <= (R[j] - r[i]) * (R[j] - r[i]))
      ans++;
    else {
      if (R[j] <= r[i] && dist <= (r[i] - R[j]) * (r[i] - R[j])) ans++;
    }
  }
  if (dist >= (R[i] + R[j]) * (R[i] + R[j]))
    ans++;
  else {
    if (r[j] >= R[i] && dist <= (r[j] - R[i]) * (r[j] - R[i]) && R[j] >= R[i] &&
        dist <= (R[j] - R[i]) * (R[j] - R[i]))
      ans++;
    else {
      if (R[j] <= R[i] && dist <= (R[i] - R[j]) * (R[i] - R[j])) ans++;
    }
  }
}
int main() {
  cin >> x[0] >> y[0] >> r[0] >> R[0];
  cin >> x[1] >> y[1] >> r[1] >> R[1];
  ans = 0;
  f(1, 0);
  f(0, 1);
  cout << ans;
  return 0;
}
