#include <bits/stdc++.h>
using namespace std;
int x[2], y[2], r[2], R[2];
bool pr;
int s, ans = 0;
int sqr(int x) { return x * x; }
bool t(int r, int R) { return sqr(r - R) >= s || sqr(r + R) <= s; }
int main() {
  for (int i = 0; i < 2; ++i) cin >> x[i] >> y[i] >> r[i] >> R[i];
  s = sqr(x[0] - x[1]) + sqr(y[0] - y[1]);
  pr = true;
  for (int i = r[1]; i <= R[1]; ++i)
    if (!t(r[0], i)) {
      pr = false;
      break;
    }
  ans += pr;
  pr = true;
  for (int i = r[1]; i <= R[1]; ++i)
    if (!t(R[0], i)) {
      pr = false;
      break;
    }
  ans += pr;
  pr = true;
  for (int i = r[0]; i <= R[0]; ++i)
    if (!t(r[1], i)) {
      pr = false;
      break;
    }
  ans += pr;
  pr = true;
  for (int i = r[0]; i <= R[0]; ++i)
    if (!t(R[1], i)) {
      pr = false;
      break;
    }
  ans += pr;
  cout << ans << endl;
  return 0;
}
