#include <bits/stdc++.h>
using namespace std;
long long dist;
inline bool check(int r1, int r2, int R2) {
  if (dist < ((r1 + R2) * (r1 + R2))) {
    if (dist <= abs((r1 - R2) * (r1 - R2)) && (R2 >= r1)) {
      if (dist <= abs((r1 - r2) * (r1 - r2)) && (r1 >= r2)) {
        return false;
      } else {
        if (dist <= abs((r1 - r2) * (r1 - r2)) && (r1 <= r2)) {
        } else {
          return false;
        }
      }
    } else {
      if (dist <= abs((r1 - R2) * (r1 - R2)) && (R2 <= r1)) {
      } else {
        return false;
      }
    }
  }
  return true;
}
int main() {
  long long x1, y1, r1, R1;
  long long x2, y2, r2, R2;
  scanf("%lld", &x1);
  scanf("%lld", &y1);
  scanf("%lld", &r1);
  scanf("%lld", &R1);
  scanf("%lld", &x2);
  scanf("%lld", &y2);
  scanf("%lld", &r2);
  scanf("%lld", &R2);
  int ans = 0;
  dist = ((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2));
  if (check(r1, r2, R2)) {
    ans++;
  }
  if (check(R1, r2, R2)) {
    ans++;
  }
  if (check(r2, r1, R1)) {
    ans++;
  }
  if (check(R2, r1, R1)) {
    ans++;
  }
  printf("%d\n", ans);
}
