#include <bits/stdc++.h>
using namespace std;
double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
bool cross(double x1, double y1, double r1, double x2, double y2, int r2) {
  double d = dist(x1, y1, x2, y2);
  if (d >= r1 + r2 || d <= abs(r1 - r2)) return false;
  return true;
}
bool inside(double x1, double y1, double r1, double x2, double y2, int r2) {
  double d = dist(x1, y1, x2, y2);
  if (r1 < r2 && d <= abs(r1 - r2)) return true;
  return false;
}
bool outside(double x1, double y1, double r1, double x2, double y2, int r2) {
  double d = dist(x1, y1, x2, y2);
  if (d >= r1 + r2) return true;
  return false;
}
void TheSolution(istream& input, ostream& output) {
  double x1, y1, r1, R1;
  double x2, y2, r2, R2;
  input >> x1 >> y1 >> r1 >> R1;
  input >> x2 >> y2 >> r2 >> R2;
  int res = 4;
  if (cross(x1, y1, r1, x2, y2, r2) || cross(x1, y1, r1, x2, y2, R2) ||
      (inside(x1, y1, r1, x2, y2, R2) &&
       (outside(x1, y1, r1, x2, y2, r2) || inside(x1, y1, r2, x2, y2, r1))))
    res--;
  if (cross(x1, y1, R1, x2, y2, r2) || cross(x1, y1, R1, x2, y2, R2) ||
      (inside(x1, y1, R1, x2, y2, R2) &&
       (outside(x1, y1, R2, x2, y2, r2) || inside(x1, y1, r2, x2, y2, R2))))
    res--;
  if (cross(x1, y1, r2, x2, y2, r1) || cross(x1, y1, r2, x2, y2, R1) ||
      (inside(x1, y1, r2, x2, y2, R1) &&
       (outside(x1, y1, r2, x2, y2, r1) || inside(x1, y1, r1, x2, y2, r2))))
    res--;
  if (cross(x1, y1, R2, x2, y2, r1) || cross(x1, y1, R2, x2, y2, R1) ||
      (inside(x1, y1, R2, x2, y2, R1) &&
       (outside(x1, y1, R2, x2, y2, r1) || inside(x1, y1, r1, x2, y2, R2))))
    res--;
  output << res;
}
int main() {
  TheSolution(cin, cout);
  return 0;
}
