#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T cAbs(T x) {
  if (x < 0) return -x;
  return x;
}
template <class T>
inline T cMax(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T cMin(T a, T b) {
  return a < b ? a : b;
}
bool chk(int x, int y, int r, int _x, int _y, int _r) {
  int d = (x - _x) * (x - _x) + (y - _y) * (y - _y);
  if (d >= (r + _r) * (r + _r)) return 1;
  if (d <= (r - _r) * (r - _r)) return 1;
  return 0;
}
int main() {
  int x, y, r, R, _x, _y, _r, _R;
  while (scanf("%d %d %d %d", &x, &y, &r, &R) == 4) {
    scanf("%d %d %d %d", &_x, &_y, &_r, &_R);
    int ans = 0;
    int R1[128], R2[128];
    int nR1 = 0, nR2 = 0;
    for (int i = r; i <= R; i++) R1[nR1++] = i;
    for (int i = _r; i <= _R; i++) R2[nR2++] = i;
    int dep;
    for (dep = 0; dep < nR2; ++dep)
      if (!chk(x, y, r, _x, _y, R2[dep])) break;
    if (dep == nR2) ans++;
    for (dep = 0; dep < nR2; ++dep)
      if (!chk(x, y, R, _x, _y, R2[dep])) break;
    if (dep == nR2) ans++;
    for (dep = 0; dep < nR1; dep++)
      if (!chk(_x, _y, _r, x, y, R1[dep])) break;
    if (dep == nR1) ans++;
    for (dep = 0; dep < nR1; dep++)
      if (!chk(_x, _y, _R, x, y, R1[dep])) break;
    if (dep == nR1) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
