#include <bits/stdc++.h>
long long int const MOD = 1000000007;
long long int const N = 1000005;
long long int const LN = 20;
long long int const inf = 1e18 + 5;
using namespace std;
long long int n, m, a[N];
long long int dist(long long int x1, long long int y1, long long int x2,
                   long long int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
long long int fn(long long int x1, long long int y1, long long int r1,
                 long long int x2, long long int y2, long long int r2) {
  long long int dd = dist(x1, y1, x2, y2);
  if (dd >= r1 * r1 + r2 * r2 + 2 * r1 * r2) return 1;
  if (r1 <= r2 && dd <= r1 * r1 + r2 * r2 - 2 * r1 * r2) return 2;
  if (r2 <= r1 && dd <= r1 * r1 + r2 * r2 - 2 * r1 * r2) return 3;
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int x1, y1, r1, R1;
  long long int x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  long long int ans = 0;
  {
    if (fn(x1, y1, r1, x2, y2, r2))
      if (fn(x1, y1, r1, x2, y2, r2) == fn(x1, y1, r1, x2, y2, R2)) ans++;
  }
  {
    if (fn(x2, y2, r2, x1, y1, R1))
      if (fn(x2, y2, r2, x1, y1, R1) == fn(x2, y2, r2, x1, y1, r1)) ans++;
  }
  {
    if (fn(x1, y1, R1, x2, y2, r2))
      if (fn(x1, y1, R1, x2, y2, r2) == fn(x1, y1, R1, x2, y2, R2)) ans++;
  }
  {
    if (fn(x2, y2, R2, x1, y1, R1))
      if (fn(x2, y2, R2, x1, y1, R1) == fn(x2, y2, R2, x1, y1, r1)) ans++;
  }
  cout << ans;
  return 0;
}
