#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native")
using namespace std;
signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  auto sq = [&](long long x) { return x * x; };
  auto check = [&](long long x1, long long y1, long long r1, long long x2,
                   long long y2, long long r2, long long rr2) {
    long long dx = abs(x1 - x2);
    long long dy = abs(y1 - y2);
    long long d2 = dx * dx + dy * dy;
    if (d2 >= sq(r1 + rr2)) return true;
    if (r1 > rr2 && d2 <= sq(r1 - rr2)) return true;
    if (r2 > r1 && d2 <= sq(r2 - r1)) return true;
    return false;
  };
  long long x1, y1, r1, rr1, x2, y2, r2, rr2;
  cin >> x1 >> y1 >> r1 >> rr1 >> x2 >> y2 >> r2 >> rr2;
  long long ans = 0;
  ans += check(x1, y1, r1, x2, y2, r2, rr2);
  ans += check(x1, y1, rr1, x2, y2, r2, rr2);
  ans += check(x2, y2, r2, x1, y1, r1, rr1);
  ans += check(x2, y2, rr2, x1, y1, r1, rr1);
  cout << ans << "\n";
}
