#include <bits/stdc++.h>
using namespace std;
struct ring {
  int x, y, r1, r2;
} a, b;
int sqr(int x) { return x * x; }
int solve() {
  int d = sqr(a.x - b.x) + sqr(a.y - b.y);
  if (d >= sqr(a.r2 + b.r2)) return 4;
  int cnt = 0;
  if (d >= sqr(max(a.r2, b.r2))) {
    if (d >= sqr(a.r1 + b.r2)) cnt++;
    if (d >= sqr(a.r2 + b.r1)) cnt++;
    return cnt;
  }
  if (b.r2 > a.r2) swap(a, b);
  if (b.r1 <= a.r1 && d <= sqr(a.r1 - b.r1)) cnt++;
  if (b.r2 <= a.r1 && d <= sqr(a.r1 - b.r2))
    cnt += 3;
  else if (d <= sqr(a.r2 - b.r2))
    cnt++;
  if (sqr(a.r1 + b.r2) <= d) cnt++;
  if (a.r1 <= b.r1 && d <= sqr(b.r1 - a.r1)) cnt++;
  return cnt;
}
int main() {
  cin >> a.x >> a.y >> a.r1 >> a.r2;
  cin >> b.x >> b.y >> b.r1 >> b.r2;
  cout << solve();
  return 0;
}
