#include <bits/stdc++.h>
using namespace std;
bool check(int x, int y, int r, int xa, int ya, int r1, int r2) {
  double dis = sqrt((x - xa) * (x - xa) + (y - ya) * (y - ya));
  if ((dis >= r + r1 && dis >= r + r2) ||
      (dis <= abs(r1 - r) && dis <= abs(r2 - r) && (r2 - r) * (r1 - r) > 0))
    return true;
  return false;
}
int main() {
  int x1, x2, y1, y2, a1, b1, a2, b2;
  cin >> x1 >> y1 >> a1 >> b1 >> x2 >> y2 >> a2 >> b2;
  int ans = 0;
  if (check(x1, y1, a1, x2, y2, a2, b2)) ans++;
  if (check(x1, y1, b1, x2, y2, a2, b2)) ans++;
  if (check(x2, y2, a2, x1, y1, a1, b1)) ans++;
  if (check(x2, y2, b2, x1, y1, a1, b1)) ans++;
  cout << ans << endl;
  return 0;
}
