#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
const int INF = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = 3.1415926535897932384626433832795;
int main() {
  ios_base::sync_with_stdio(0);
  int x1, x2, y1, y2, r1, R1, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int cen = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  int ans = 0;
  if (R2 < R1 && (R1 - R2) * (R1 - R2) >= cen)
    ans++;
  else if (R1 < r2 && (r2 - R1) * (r2 - R1) >= cen)
    ans++;
  else if ((R1 + R2) * (R1 + R2) <= cen)
    ans++;
  if (R1 < R2 && (R2 - R1) * (R2 - R1) >= cen)
    ans++;
  else if (R2 < r1 && (r1 - R2) * (r1 - R2) >= cen)
    ans++;
  else if ((R1 + R2) * (R1 + R2) <= cen)
    ans++;
  if ((R2 + r1) * (R2 + r1) <= cen)
    ans++;
  else if (R2 < r1 && cen <= (r1 - R2) * (r1 - R2))
    ans++;
  else if (r1 < r2 && cen <= (r1 - r2) * (r1 - r2))
    ans++;
  if ((R1 + r2) * (R1 + r2) <= cen)
    ans++;
  else if (R1 < r2 && cen <= (r2 - R1) * (r2 - R1))
    ans++;
  else if (r2 < r1 && cen <= (r1 - r2) * (r1 - r2))
    ans++;
  cout << ans;
  return 0;
}
