#include <bits/stdc++.h>
using namespace std;
struct ring {
  int c1;
  int c2;
  int r1;
  int r2;
};
int contour(struct ring a, struct ring b, double dist) {
  int cnt = 0;
  if (dist >= a.r2 + b.r2 || dist <= b.r1 - a.r2 || dist <= a.r2 - b.r2) cnt++;
  if (dist >= a.r1 + b.r2 || dist <= b.r1 - a.r1 || dist <= a.r1 - b.r2) cnt++;
  return cnt;
}
int main() {
  struct ring a, b;
  cin >> a.c1 >> a.c2 >> a.r1 >> a.r2;
  cin >> b.c1 >> b.c2 >> b.r1 >> b.r2;
  double dist =
      sqrt((a.c1 - b.c1) * (a.c1 - b.c1) + (a.c2 - b.c2) * (a.c2 - b.c2));
  int ans = contour(a, b, dist) + contour(b, a, dist);
  cout << ans << endl;
  return 0;
}
