#include <bits/stdc++.h>
using namespace std;
bool check(int x, int y, int r, int xx, int yy, int rr, int RR) {
  int dr = r - rr;
  int sr = r + rr;
  int dx = x - xx;
  int dy = y - yy;
  int d2 = dx * dx + dy * dy;
  int dR = r - RR;
  int sR = r + RR;
  if (r <= rr && d2 <= dr * dr) {
    return true;
  }
  if (r >= RR && d2 <= dR * dR) {
    return true;
  }
  if (d2 >= sR * sR) {
    return true;
  }
  return false;
}
int main() {
  int xa, ya, ra, Ra;
  int xb, yb, rb, Rb;
  cin >> xa >> ya >> ra >> Ra;
  cin >> xb >> yb >> rb >> Rb;
  int count = 0;
  if (check(xa, ya, ra, xb, yb, rb, Rb)) {
    count++;
  }
  if (check(xa, ya, Ra, xb, yb, rb, Rb)) {
    count++;
  }
  if (check(xb, yb, rb, xa, ya, ra, Ra)) {
    count++;
  }
  if (check(xb, yb, Rb, xa, ya, ra, Ra)) {
    count++;
  }
  cout << count << endl;
  return 0;
}
