#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
  point() : x(0), y(0) {}
  point(double _x, double _y) : x(_x), y(_y) {}
  point operator+(point other) { return point(x + other.x, y + other.y); }
  point operator-(point other) { return point(x - other.x, y - other.y); }
};
double dot(point p1, point p2) { return p1.x * p2.x + p1.y * p2.y; }
double norm(point p) { return sqrt(dot(p, p)); }
bool inside(point p1, double r1, point p2, double r2) {
  double d = norm(p2 - p1);
  return d + r1 < r2 + 1e-9;
}
bool outside(point p1, double r1, point p2, double r2) {
  if (inside(p2, r2, p1, r1)) return true;
  double d = norm(p2 - p1);
  return d - r1 > r2 - 1e-9;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(12);
  point p1, p2;
  double r1, R1, r2, R2;
  cin >> p1.x >> p1.y >> r1 >> R1;
  cin >> p2.x >> p2.y >> r2 >> R2;
  int count = 0;
  if (inside(p1, r1, p2, r2) || outside(p1, r1, p2, R2)) count++;
  if (inside(p1, R1, p2, r2) || outside(p1, R1, p2, R2)) count++;
  if (inside(p2, r2, p1, r1) || outside(p2, r2, p1, R1)) count++;
  if (inside(p2, R2, p1, r1) || outside(p2, R2, p1, R1)) count++;
  cout << count << endl;
}
