#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
pair<int, int> c1, c2, r1, r2;
int ans = 0;
long double dst(pair<int, int> a, pair<int, int> b) {
  return (a.first - b.first) * (a.first - b.first) +
         (a.second - b.second) * (a.second - b.second);
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  cin >> c1.first >> c1.second >> r1.first >> r1.second;
  cin >> c2.first >> c2.second >> r2.first >> r2.second;
  long double D = dst(c1, c2);
  if (D > r1.first * r1.first) {
    if ((sqrt(D) >= r1.first + r2.second) || (sqrt(D) + r1.first <= r2.first))
      ans++;
  } else {
    if ((sqrt(D) + r2.second <= r1.first) || (sqrt(D) + r1.first <= r2.first))
      ans++;
  }
  if (D > r2.first * r2.first) {
    if ((sqrt(D) >= r2.first + r1.second) || (sqrt(D) + r2.first <= r1.first))
      ans++;
  } else {
    if ((sqrt(D) + r1.second <= r2.first) || (sqrt(D) + r2.first <= r1.first))
      ans++;
  }
  if (D > r1.second * r1.second) {
    if ((sqrt(D) >= r1.second + r2.second) || (sqrt(D) + r1.second <= r2.first))
      ans++;
  } else {
    if ((sqrt(D) + r2.second <= r1.second) || (sqrt(D) + r1.second <= r2.first))
      ans++;
  }
  if (D > r2.second * r2.second) {
    if ((sqrt(D) >= r2.second + r1.second) || (sqrt(D) + r2.second <= r1.first))
      ans++;
  } else {
    if ((sqrt(D) + r1.second <= r2.second) || (sqrt(D) + r2.second <= r1.first))
      ans++;
  }
  cout << ans;
  return 0;
}
