#include <bits/stdc++.h>
using namespace std;
int main() {
  int x1, x2, y1, y2, r1, r2, s1, s2, ans = 0;
  double t;
  cin >> x1 >> y1 >> r1 >> s1;
  cin >> x2 >> y2 >> r2 >> s2;
  t = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  if (t * t >= (r1 + s2) * (r1 + s2) || (t + r1) * (t + r1) <= r2 * r2 ||
      (t + s2) * (t + s2) <= r1 * r1)
    ans++;
  if (t * t >= (r2 + s1) * (r2 + s1) || (t + r2) * (t + r2) <= r1 * r1 ||
      (t + s1) * (t + s1) <= r2 * r2)
    ans++;
  if (t * t >= (s1 + s2) * (s1 + s2) || (t + s1) * (t + s1) <= r2 * r2 ||
      (t + s2) * (t + s2) <= s1 * s1)
    ans++;
  if (t * t >= (s2 + s1) * (s2 + s1) || (t + s2) * (t + s2) <= r1 * r1 ||
      (t + s1) * (t + s1) <= s2 * s2)
    ans++;
  cout << ans;
  return 0;
}
