#include <bits/stdc++.h>
using namespace std;
bool check(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
  int l = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  int rr1 = (r1 - r2) * (r1 - r2);
  int rr2 = (r1 + r2) * (r1 + r2);
  int RR1 = (r1 - R2) * (r1 - R2);
  int RR2 = (r1 + R2) * (r1 + R2);
  if (l <= rr1 && l <= RR1 && (r1 <= r2 || r1 >= R2)) return 1;
  if (rr2 <= l && RR2 <= l) 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) != EOF) {
    scanf("%d %d %d %d", &x2, &y2, &r2, &R2);
    int ans = 0;
    if (check(x1, y1, r1, x2, y2, r2, R2)) ans++;
    if (check(x1, y1, R1, x2, y2, r2, R2)) ans++;
    if (check(x2, y2, r2, x1, y1, r1, R1)) ans++;
    if (check(x2, y2, R2, x1, y1, r1, R1)) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
