#include <bits/stdc++.h>
using namespace std;
int x[3], y[3], r[3], R[3];
int main() {
  for (int i = 1; i <= 2; i++) scanf("%d %d %d %d", &x[i], &y[i], &r[i], &R[i]);
  int count = 0;
  double d =
      sqrt(((x[1] - x[2]) * (x[1] - x[2])) + ((y[1] - y[2]) * (y[1] - y[2])));
  if ((d == ((r[1] + R[1]) / 2.0)) && (2 * R[2] <= R[1] - r[1])) {
    printf("2\n");
    return 0;
  }
  if ((d == ((r[2] + R[2]) / 2.0)) && (2 * R[1] <= R[2] - r[2])) {
    printf("2\n");
    return 0;
  }
  if ((d + r[1] <= r[2]) || (d - r[1] >= R[2]) || (d + R[2] <= r[1])) count++;
  if ((d + R[1] <= r[2]) || (d - R[1] >= R[2]) || (d + R[2] <= R[1])) count++;
  if ((d + r[2] <= r[1]) || (d - r[2] >= R[1]) || (d + R[1] <= r[2])) count++;
  if ((d + R[2] <= r[1]) || (d - R[2] >= R[1]) || (d + R[1] <= R[2])) count++;
  printf("%d\n", count);
  return 0;
}
