#include <bits/stdc++.h>
using namespace std;
long double dist(long long x, long long y) { return sqrt(x * x + y * y); }
bool good(long double d, long double r, long double r1, long double R1) {
  if (d + r <= r1) return 1;
  if (d >= r + R1) return 1;
  if (d + R1 <= r) return 1;
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long x1, y1, x2, y2, r1, R1, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
  long double d = dist(x1 - x2, y1 - y2);
  int ats = good(d, r1, r2, R2) + good(d, R1, r2, R2) + good(d, r2, r1, R1) +
            good(d, R2, r1, R1);
  cout << ats;
}
