#include <bits/stdc++.h>
using namespace std;
int dist(int xi, int yi, int xj, int yj) {
  return (xi - xj) * (xi - xj) + (yi - yj) * (yi - yj);
}
bool isok(int r1, int r2, int r3, int dis) {
  for (int i = r2; i <= r3; i++) {
    if ((r1 + i) * (r1 + i) > dis && dis > abs(r1 - i) * abs(r1 - i)) {
      return false;
    }
  }
  return true;
}
int main() {
  int i, j, h;
  int T, n, m;
  int cas = 1;
  int xi, yi, ri, Ri;
  int xj, yj, rj, Rj;
  scanf("%d%d%d%d", &xi, &yi, &ri, &Ri);
  scanf("%d%d%d%d", &xj, &yj, &rj, &Rj);
  int ans = 0;
  int dis = dist(xi, yi, xj, yj);
  if (isok(ri, rj, Rj, dis)) ans++;
  if (isok(Ri, rj, Rj, dis)) ans++;
  if (isok(rj, ri, Ri, dis)) ans++;
  if (isok(Rj, ri, Ri, dis)) ans++;
  printf("%d\n", ans);
  return 0;
}
