#include <bits/stdc++.h>
const int inf = (1ll << 30) - 1;
const int maxn = (int)1e5 + 10;
const int mod = (int)1e9 + 7;
using namespace std;
vector<pair<pair<int, int>, int> > v;
int calc(int r1, int x2, int y2, int r2) {
  int a = -2 * x2;
  int b = -2 * y2;
  int c = x2 * x2 + y2 * y2 + r1 * r1 - r2 * r2;
  if (c * c > r1 * r1 * (a * a + b * b))
    return 0;
  else if (abs(c * c - r1 * r1 * (a * a + b * b)) == 0) {
    return 1;
  } else {
    return 2;
  }
}
int inside(int r1, int x2, int y2, int r2) {
  if (r2 <= r1) return 0;
  return x2 * x2 + y2 * y2 <= (r2 - r1) * (r2 - r1);
}
int outside(int r1, int x2, int y2, int r2) {
  if (r2 >= r1) return 0;
  return x2 * x2 + y2 * y2 <= (r2 - r1) * (r2 - r1);
}
int ok(pair<pair<int, int>, int> x) {
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == x.first) continue;
    if (calc(x.second, v[i].first.first - x.first.first,
             v[i].first.second - x.first.second, v[i].second) == 2)
      return 0;
  }
  int I = 0, O = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first == x.first) continue;
    if (inside(x.second, v[i].first.first - x.first.first,
               v[i].first.second - x.first.second, v[i].second)) {
      if (i % 2 == 0) return 1;
      return 0;
    }
  }
  return 1;
}
void solve() {
  for (int i = 0; i < 2; i++) {
    int x, y, r, R;
    cin >> x >> y >> r >> R;
    v.push_back(make_pair(make_pair(x, y), r));
    v.push_back(make_pair(make_pair(x, y), R));
  }
  int ans = 0;
  for (int i = 0; i < v.size(); i++) ans += ok(v[i]);
  cout << ans << "\n";
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
