#include <bits/stdc++.h>
using namespace std;
long double dist(int x1, int y1, int x2, int y2) {
  return sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  int x1, y1, r1, R1, x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
  int ans = 0;
  long double x = dist(x1, y1, x2, y2);
  if (r1 + x <= r2 || R2 + x <= r1 || R2 + r1 <= x) ans++;
  if (r2 + x <= r1 || R1 + x <= r2 || R1 + r2 <= x) ans++;
  if (R1 + R2 <= x || R1 + x <= r2 || R2 + x <= R1) ans++;
  if (R1 + R2 <= x || R2 + x <= r1 || R1 + x <= R2) ans++;
  cout << ans;
  return 0;
}
