#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535;
double squared(double n) { return n * n; }
typedef struct {
  int cx;
  int cy;
  int r;
  int R;
} circle_t;
bool isBlack(double x, double y, circle_t c) {
  double val = squared(x - (double)c.cx) + squared(y - (double)c.cy);
  if (val > squared(c.R)) {
    return false;
  } else if (val >= squared(c.r)) {
    return true;
  } else {
    return false;
  }
}
int returnOkNum(circle_t c, circle_t c2) {
  int blackOutNum = 0;
  int blackInNum = 0;
  int ret = 0;
  const int DIVIDE = 100000;
  for (int i = 0; i < DIVIDE; ++i) {
    double xOut = (double)c.R * cos(2.0 * PI * i / DIVIDE) + c.cx;
    double yOut = (double)c.R * sin(2.0 * PI * i / DIVIDE) + c.cy;
    double xIn = (double)c.r * cos(2.0 * PI * i / DIVIDE) + c.cx;
    double yIn = (double)c.r * sin(2.0 * PI * i / DIVIDE) + c.cy;
    if (isBlack(xOut, yOut, c2)) {
      ++blackOutNum;
    }
    if (isBlack(xIn, yIn, c2)) {
      ++blackInNum;
    }
  }
  if (blackOutNum <= 3) {
    ++ret;
  }
  if (blackInNum <= 3) {
    ++ret;
  }
  return ret;
}
int main(void) {
  vector<circle_t> cs(2);
  for (int i = 0; i < 2; ++i) {
    cin >> cs[i].cx >> cs[i].cy >> cs[i].r >> cs[i].R;
  }
  int ret = returnOkNum(cs[0], cs[1]);
  ret += returnOkNum(cs[1], cs[0]);
  cout << ret << endl;
  return 0;
}
