#include <bits/stdc++.h>
using namespace std;
struct circle {
  double x, y, r;
} a[5];
double dis;
double sqr(double a) { return a * a; }
bool cut(circle a, circle b) {
  dis = sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
  if (a.r > b.r) swap(a, b);
  if (dis >= a.r + b.r) return false;
  if (dis + a.r <= b.r) return false;
  return true;
}
bool in(circle a, circle b) {
  dis = sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
  if (dis + a.r <= b.r) return true;
  return false;
}
int main() {
  for (int i = 0; i < 2; i++) {
    cin >> a[i].x >> a[i].y >> a[i].r >> a[i + 2].r;
    a[i + 2].x = a[i].x;
    a[i + 2].y = a[i].y;
  }
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    bool pre = true;
    for (int k = 0; k < 4; k++)
      if (cut(a[i], a[k])) pre = false;
    int k = ((i % 2) ^ 1);
    if (in(a[i], a[k + 2]) && !in(a[i], a[k])) pre = false;
    ans += pre;
  }
  cout << ans << endl;
}
