#include <bits/stdc++.h>
using namespace std;
struct circle {
  int x, y, r;
  circle(int a, int b, int c) { x = a, y = b, r = c; }
};
vector<circle> v1, v2;
double dist(circle a, circle b) {
  return sqrt((double)(a.x - b.x) * (a.x - b.x) +
              (double)(a.y - b.y) * (a.y - b.y));
}
int main() {
  int x, y, r, R, i;
  cin >> x >> y >> r >> R;
  v1.push_back(circle(x, y, r));
  v1.push_back(circle(x, y, R));
  cin >> x >> y >> r >> R;
  v2.push_back(circle(x, y, r));
  v2.push_back(circle(x, y, R));
  int cnt = 0;
  for (i = 0; i < 2; i++) {
    if (dist(v1[i], v2[0]) >= v1[i].r + v2[0].r &&
        dist(v1[i], v2[1]) >= v1[i].r + v2[1].r)
      cnt++;
    if (dist(v1[i], v2[0]) <= abs(v1[i].r - v2[0].r) &&
        dist(v1[i], v2[1]) <= abs(v1[i].r - v2[1].r) &&
        ((v1[i].r <= v2[0].r && v1[i].r <= v2[1].r) ||
         (v1[i].r >= v2[0].r && v1[i].r >= v2[1].r)))
      cnt++;
    if (dist(v2[i], v1[0]) >= v2[i].r + v1[0].r &&
        dist(v2[i], v1[1]) >= v2[i].r + v1[1].r)
      cnt++;
    if (dist(v2[i], v1[0]) <= abs(v2[i].r - v1[0].r) &&
        dist(v2[i], v1[1]) <= abs(v2[i].r - v1[1].r) &&
        ((v2[i].r <= v1[0].r && v2[i].r <= v1[1].r) ||
         (v2[i].r >= v1[0].r && v2[i].r >= v1[1].r)))
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
