#include <bits/stdc++.h>
using namespace std;
int fh(int X, int Y, int R, int tx, int ty, int tr) {
  if (((R + tr) * (R + tr)) <= ((X - tx) * (X - tx) + (Y - ty) * (Y - ty)))
    return 1;
  return 0;
}
int fh2(int X, int Y, int R, int tx, int ty, int tr) {
  if (((R - tr) * (R - tr)) >= ((X - tx) * (X - tx) + (Y - ty) * (Y - ty))) {
    if (R > tr)
      return 1;
    else
      return -1;
  }
  return 0;
}
int xx1, yy1, r11, r12, r21, r22, xx2, yy2;
int Djj = 0;
int main() {
  cin >> xx1 >> yy1 >> r11 >> r12;
  cin >> xx2 >> yy2 >> r21 >> r22;
  Djj = 0;
  if ((fh(xx1, yy1, r11, xx2, yy2, r21) * fh(xx1, yy1, r11, xx2, yy2, r22)) ==
      1)
    Djj++;
  if ((fh(xx1, yy1, r12, xx2, yy2, r21) * fh(xx1, yy1, r12, xx2, yy2, r22)) ==
      1)
    Djj++;
  if ((fh(xx1, yy1, r11, xx2, yy2, r21) * fh(xx1, yy1, r12, xx2, yy2, r21)) ==
      1)
    Djj++;
  if ((fh(xx1, yy1, r11, xx2, yy2, r22) * fh(xx1, yy1, r12, xx2, yy2, r22)) ==
      1)
    Djj++;
  if ((fh2(xx1, yy1, r11, xx2, yy2, r21) * fh2(xx1, yy1, r11, xx2, yy2, r22)) ==
      1)
    Djj++;
  if ((fh2(xx1, yy1, r12, xx2, yy2, r21) * fh2(xx1, yy1, r12, xx2, yy2, r22)) ==
      1)
    Djj++;
  if ((fh2(xx1, yy1, r11, xx2, yy2, r21) * fh2(xx1, yy1, r12, xx2, yy2, r21)) ==
      1)
    Djj++;
  if ((fh2(xx1, yy1, r11, xx2, yy2, r22) * fh2(xx1, yy1, r12, xx2, yy2, r22)) ==
      1)
    Djj++;
  cout << Djj << endl;
  return 0;
}
