#include <bits/stdc++.h>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  unsigned long long c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
bool get(int x, int y, int r, int xx, int yy, int R, int RR) {
  return ((sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) >= (r + R) &&
           sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) >= (r + RR)) ||
          (R >= (sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) + r) &&
           RR >= (sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) + r)) ||
          (r >= (sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) + R) &&
           r >= (sqrt(((x - xx) * (x - xx)) + ((y - yy) * (y - yy))) + RR)));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int x, y, r, R, xx, yy, rr, RR;
  while (cin >> x >> y >> r >> R >> xx >> yy >> rr >> RR) {
    int rrr[] = {r, R, rr, RR};
    cout << get(x, y, r, xx, yy, rr, RR) + get(x, y, R, xx, yy, rr, RR) +
                get(xx, yy, rr, x, y, r, R) + get(xx, yy, RR, x, y, r, R)
         << "\n";
  }
  return 0;
}
