#include <bits/stdc++.h>
using namespace std;
template <class T>
T mabs(T a) {
  if (a < 0) return -a;
  return a;
}
bool in_circ(double r1, double dist, double r2) {
  return mabs(dist - r2) <= r1 && dist + r2 <= r1;
}
bool out_circ(double r1, double dist, double r2) {
  return mabs(dist - r2) >= r1 && dist + r2 >= r1;
}
int main(void) {
  int x1, y1, x2, y2, r1, R1, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  double dist = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  int sol = 0;
  if (in_circ(r1, dist, r2) || out_circ(R1, dist, r2)) ++sol;
  if (in_circ(r1, dist, R2) || out_circ(R1, dist, R2)) ++sol;
  if (in_circ(r2, dist, r1) || out_circ(R2, dist, r1)) ++sol;
  if (in_circ(r2, dist, R1) || out_circ(R2, dist, R1)) ++sol;
  cout << sol << endl;
  return 0;
}
