#include <bits/stdc++.h>
int cal1(int x1, int x2, int y1, int y2, int r1, int r2, int r3) {
  double dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  if (dis <= r2 - r1) {
    return 1;
  }
  if (dis <= r1 - r3) {
    return 1;
  }
  if (dis >= r3 + r1) {
    return 1;
  }
  return 0;
}
int cal2(int x1, int x2, int y1, int y2, int r1, int r2, int r3) {
  double dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  if (dis <= r2 - r1) {
    return 1;
  }
  if (dis <= r1 - r3) {
    return 1;
  }
  if (dis >= r3 + r1) {
    return 1;
  }
  return 0;
}
int main() {
  int x1, y1, r1, R1, x2, y2, r2, R2;
  while (~scanf("%d%d%d%d", &x1, &y1, &r1, &R1)) {
    scanf("%d%d%d%d", &x2, &y2, &r2, &R2);
    int ans = 0;
    ans += cal1(x1, x2, y1, y2, r1, r2, R2);
    ans += cal2(x1, x2, y1, y2, R1, r2, R2);
    ans += cal1(x1, x2, y1, y2, r2, r1, R1);
    ans += cal2(x1, x2, y1, y2, R2, r1, R1);
    printf("%d\n", ans);
  }
  return 0;
}
