#include <bits/stdc++.h>
using namespace std;
int s(int x) { return x * x; }
int main() {
  int x1, y1, r1, R1, x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
  int T = 0;
  if (r1 < r2) {
    swap(r1, r2);
    swap(R1, R2);
  }
  int D = s(x1 - x2) + s(y1 - y2);
  if (s(r1 + R2) <= D)
    ++T;
  else if (r1 > R2 && D <= s(r1 - R2)) {
    cout << 4;
    return 0;
  } else if (r2 < r1 && s(r1 - r2) >= D) {
    ++T;
  }
  if (s(R2 - R1) >= D) ++T;
  if (s(r2 + R1) <= D)
    ++T;
  else if (r2 > R1 && D <= s(r2 - R1))
    T += 2;
  if (D >= s(R1 + R2)) T += 2;
  cout << T;
  return 0;
}
