#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:25600000")
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int INF = 1000000000;
bool check(int x, int y, int r, int x1, int y1, int r1, int R1) {
  double dist = sqrt(1.0 * ((x - x1) * (x - x1) + (y - y1) * (y - y1)));
  if (dist + r <= r1) return true;
  if (dist + R1 <= r) return true;
  if (r + R1 <= dist) return true;
  return false;
}
int main() {
  int x1, y1, r1, R1, x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int ans = 0;
  ans += check(x1, y1, r1, x2, y2, r2, R2);
  ans += check(x1, y1, R1, x2, y2, r2, R2);
  ans += check(x2, y2, r2, x1, y1, r1, R1);
  ans += check(x2, y2, R2, x1, y1, r1, R1);
  cout << ans << endl;
}
