#include <bits/stdc++.h>
using namespace std;
int contact(int x1, int y1, int r1, int x2, int y2, int r2) {
  int dx = x1 - x2, dy = y1 - y2;
  int sq_dist = dx * dx + dy * dy;
  if (sq_dist >= (r1 + r2) * (r1 + r2))
    return -1;
  else if (sq_dist <= (r1 - r2) * (r1 - r2)) {
    return (r1 < r2) ? +1 : -1;
  } else
    return 0;
}
bool check(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
  int inner = contact(x1, y1, r1, x2, y2, r2);
  int outer = contact(x1, y1, r1, x2, y2, R2);
  return (inner == outer && inner != 0);
}
int main() {
  int x1, y1, r1, R1;
  cin >> x1 >> y1 >> r1 >> R1;
  int x2, y2, r2, R2;
  cin >> x2 >> y2 >> r2 >> R2;
  int answer = 0;
  if (check(x1, y1, r1, x2, y2, r2, R2)) {
    answer += 1;
  }
  if (check(x1, y1, R1, x2, y2, r2, R2)) {
    answer += 1;
  }
  if (check(x2, y2, r2, x1, y1, r1, R1)) {
    answer += 1;
  }
  if (check(x2, y2, R2, x1, y1, r1, R1)) {
    answer += 1;
  }
  cout << answer << "\n";
  return 0;
}
