#include <bits/stdc++.h>
using namespace std;
struct RING {
  int x, y, R;
  bool b;
} ring[4];
int main() {
  int x, y, r, R;
  cin >> x >> y >> r >> R;
  ring[0].x = ring[1].x = x;
  ring[0].y = ring[1].y = y;
  ring[0].R = r;
  ring[1].R = R;
  cin >> x >> y >> r >> R;
  ring[2].x = ring[3].x = x;
  ring[2].y = ring[3].y = y;
  ring[2].R = r;
  ring[3].R = R;
  ring[0].b = ring[1].b = ring[2].b = ring[3].b = 1;
  for (int i = 0; i < 2; i++)
    for (int j = 2; j < 4; j++) {
      double d =
          sqrt(double((ring[i].x - ring[j].x) * (ring[i].x - ring[j].x) +
                      (ring[i].y - ring[j].y) * (ring[i].y - ring[j].y)));
      if (d < ring[i].R + ring[j].R && d > abs(ring[i].R - ring[j].R))
        ring[i].b = ring[j].b = 0;
    }
  for (int i = 0; i < 2; i++) {
    double d = sqrt(double((ring[i].x - ring[2].x) * (ring[i].x - ring[3].x) +
                           (ring[i].y - ring[2].y) * (ring[i].y - ring[2].y)));
    if (ring[i].R + d <= ring[3].R && ring[i].R - d >= ring[2].R) ring[i].b = 0;
  }
  for (int i = 0; i < 2; i++) {
    double d = sqrt(double((ring[i].x - ring[2].x) * (ring[i].x - ring[3].x) +
                           (ring[i].y - ring[2].y) * (ring[i].y - ring[2].y)));
    if (d <= ring[3].R - ring[i].R && d >= ring[2].R + ring[i].R) ring[i].b = 0;
  }
  for (int i = 2; i < 4; i++) {
    double d = sqrt(double((ring[i].x - ring[0].x) * (ring[i].x - ring[0].x) +
                           (ring[i].y - ring[0].y) * (ring[i].y - ring[0].y)));
    if (d <= ring[1].R - ring[i].R && d >= ring[0].R + ring[i].R) ring[i].b = 0;
  }
  for (int i = 2; i < 4; i++) {
    int d =
        int(sqrt(double((ring[i].x - ring[0].x) * (ring[i].x - ring[0].x) +
                        (ring[i].y - ring[0].y) * (ring[i].y - ring[0].y))) +
            1e-12);
    if (ring[i].R + d <= ring[1].R && ring[i].R - d >= ring[0].R) ring[i].b = 0;
  }
  cout << ring[0].b + ring[1].b + ring[2].b + ring[3].b << endl;
  return 0;
}
