#include <bits/stdc++.h>
using namespace std;
int n, m;
bool check(int r0, int r, int R, int l1) {
  double l = sqrt((double)l1);
  if (l >= R + r0 || l + r0 <= r || r0 - l >= R)
    return true;
  else
    return false;
}
int main() {
  int x1, y1, x2, y2, r1, r2, R1, R2, res = 0;
  cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
  int l = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  if (check(r1, r2, R2, l)) ++res;
  if (check(r2, r1, R1, l)) ++res;
  if (check(R1, r2, R2, l)) ++res;
  if (check(R2, r1, R1, l)) ++res;
  cout << res;
  return 0;
}
