#include <bits/stdc++.h>
using namespace std;
int sq(int a) { return a * a; }
int dis(int x1, int y1, int x2, int y2) { return sq(x2 - x1) + sq(y2 - y1); }
int check(int d, int r, int r1, int r2) {
  if (d >= sq(r + r2)) return 1;
  if (r <= r1 && d <= sq(r - r1)) return 1;
  if (r >= r2 && d <= sq(r - r2)) return 1;
  return 0;
}
int main() {
  int x1, y1, x2, y2, r1, r2, R1, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int d = dis(x1, y1, x2, y2);
  int ans = 0;
  ans += check(d, r1, r2, R2);
  ans += check(d, R1, r2, R2);
  ans += check(d, r2, r1, R1);
  ans += check(d, R2, r1, R1);
  cout << ans << endl;
  return 0;
}
