#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-6;
inline int DIST_POW(int x1, int y1, int x2, int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
inline bool inside(pair<int, int> o1, pair<int, int> o2, int r1, int r2) {
  int O1O2 = DIST_POW(o1.first, o1.second, o2.first, o2.second);
  return O1O2 <= (r1 - r2) * (r1 - r2);
}
inline bool outside(pair<int, int> o1, pair<int, int> o2, int r1, int r2) {
  int O1O2 = DIST_POW(o1.first, o1.second, o2.first, o2.second);
  return O1O2 >= (r1 + r2) * (r1 + r2);
}
int main() {
  pair<int, int> p[2];
  int r[2], R[2];
  for (int i = 0; i < 2; i++)
    scanf("%d %d %d %d", &p[i].first, &p[i].second, r + i, R + i);
  bitset<4> suck;
  for (int i = 0; i < 2; i++) {
    int j = i ^ 1;
    if (!inside(p[i], p[j], r[i], r[j]) && !outside(p[i], p[j], r[i], r[j])) {
      suck[i * 2] = true;
      suck[j * 2] = true;
    }
    if (!inside(p[i], p[j], r[i], R[j]) && !outside(p[i], p[j], r[i], R[j])) {
      suck[i * 2] = true;
      suck[j * 2 + 1] = true;
    }
    if (!inside(p[i], p[j], R[i], r[j]) && !outside(p[i], p[j], R[i], r[j])) {
      suck[i * 2 + 1] = true;
      suck[j * 2] = true;
    }
    if (!inside(p[i], p[j], R[i], R[j]) && !outside(p[i], p[j], R[i], R[j])) {
      suck[i * 2 + 1] = true;
      suck[j * 2 + 1] = true;
    }
    if (inside(p[i], p[j], r[i], r[j]) && inside(p[i], p[j], r[i], R[j]) &&
        r[i] > r[j] && r[i] < R[j])
      suck[i * 2] = true;
    if (outside(p[i], p[j], r[i], r[j]) && inside(p[i], p[j], r[i], R[j]))
      suck[i * 2] = true;
    if (inside(p[i], p[j], R[i], r[j]) && inside(p[i], p[j], R[i], R[j]) &&
        R[i] > r[j] && R[i] < R[j])
      suck[i * 2 + 1] = true;
    if (outside(p[i], p[j], R[i], r[j]) && inside(p[i], p[j], R[i], R[j]))
      suck[i * 2 + 1] = true;
  }
  printf("%d\n", ((int)(suck).size()) - suck.count());
  return 0;
}
