#include <bits/stdc++.h>
using namespace std;
bool check(double x, double x1, double y, double y1, double r, double r1,
           double r2) {
  if (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) <= r1 - r) return true;
  if (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) >= r + r2) return true;
  if (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) <= r - r2) return true;
  return false;
}
int main() {
  double x;
  double x1;
  double y;
  double y1;
  int k = 0;
  double r[4];
  scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &x, &y, &r[0], &r[1], &x1, &y1, &r[2],
        &r[3]);
  if (check(x, x1, y, y1, r[0], r[2], r[3])) k++;
  if (check(x, x1, y, y1, r[1], r[2], r[3])) k++;
  if (check(x, x1, y, y1, r[2], r[0], r[1])) k++;
  if (check(x, x1, y, y1, r[3], r[0], r[1])) k++;
  cout << k << endl;
  return 0;
}
