#include <bits/stdc++.h>
using namespace std;
int x1, yy1, r1, R1;
int x2, y2, r2, R2;
int dis;
inline bool inside(int r, int R) {
  double dist = sqrt((double)dis);
  if (dist <= double(R - r)) return true;
  return false;
}
inline bool outside(int r, int R) {
  double dist = sqrt((double)dis);
  if (dist >= double(R + r)) return true;
  return false;
}
int main() {
  scanf("%d%d%d%d", &x1, &yy1, &r1, &R1);
  scanf("%d%d%d%d", &x2, &y2, &r2, &R2);
  dis = (x1 - x2) * (x1 - x2) + (yy1 - y2) * (yy1 - y2);
  if (R1 > R2) {
    swap(x1, x2);
    swap(yy1, y2);
    swap(r1, r2);
    swap(R1, R2);
  }
  int ans = 0;
  if (inside(r1, r2) || outside(r1, R2)) ans++;
  if (inside(R1, r2) || outside(R1, R2)) ans++;
  if (inside(R1, r2) || inside(r2, r1) || outside(r2, R1)) ans++;
  if (inside(R1, R2) || outside(R1, R2)) ans++;
  printf("%d", ans);
  return 0;
}
