#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = (int)1e9;
const double inf1 = 1e-9;
int length(int x1, int x2, int y1, int y2) {
  return ((x1 - x2) * (x1 - x2) + ((y1 - y2) * (y1 - y2)));
}
bool check(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
  int d = length(x1, x2, y1, y2);
  if ((r1 > R2) && (d <= ((r1 - R2) * (r1 - R2)))) return true;
  if ((r1 < r2) && (d <= ((r1 - r2) * (r1 - r2)))) return true;
  if (d >= ((r1 + R2) * (r1 + R2))) return true;
  return false;
}
int main() {
  int x1, y1, x2, y2, R1, r1, R2, r2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  bool b1 = false, b2 = false, b3 = false, b4 = false;
  b1 = check(x1, y1, r1, x2, y2, r2, R2);
  b2 = check(x1, y1, R1, x2, y2, r2, R2);
  b3 = check(x2, y2, r2, x1, y1, r1, R1);
  b4 = check(x2, y2, R2, x1, y1, r1, R1);
  int i = b1 + b2 + b3 + b4;
  cout << i;
  return 0;
}
