#include <bits/stdc++.h>
using namespace std;
double dist(double x1, double x2, double y1, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
bool in_circle(double d, double r1, double r2) { return d + r1 <= r2; }
bool out_circle(double d, double r1, double r2) {
  if (d >= r1 + r2) return true;
  return in_circle(d, r2, r1);
}
int main() {
  double x1, y1, r1, R1;
  double x2, y2, r2, R2;
  while (cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2) {
    double d = dist(x1, x2, y1, y2);
    int ans = 0;
    if (in_circle(d, r1, r2) || out_circle(d, r1, R2)) ans++;
    if (in_circle(d, R1, r2) || out_circle(d, R1, R2)) ans++;
    if (in_circle(d, r2, r1) || out_circle(d, r2, R1)) ans++;
    if (in_circle(d, R2, r1) || out_circle(d, R2, R1)) ans++;
    cout << ans << endl;
  }
  return 0;
}
