#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-10;
double EQ(double a, double b) { return abs(a - b) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }
int xs[4];
int ys[4];
int rs[4];
int Rs[4];
void solve() {
  for (int i = 0; i < 2; i++) {
    cin >> xs[i * 2] >> ys[i * 2] >> rs[i * 2] >> Rs[i * 2];
    xs[i * 2 + 1] = xs[i * 2];
    ys[i * 2 + 1] = ys[i * 2];
    rs[i * 2 + 1] = Rs[i * 2];
  }
  int cnt = 0;
  for (int i = 0; i < 4; i++) {
    bool ok = true;
    int soto = 0;
    int naka = 0;
    int hana = 0;
    for (int j = 0; j < 4; j++) {
      if (i == j)
        continue;
      else if (i == 0 && j == 1)
        continue;
      else if (i == 1 && j == 0)
        continue;
      else if (i == 2 && j == 3)
        continue;
      else if (i == 3 && j == 2)
        continue;
      int r = max(rs[i], rs[j]);
      int rp = min(rs[i], rs[j]);
      double d = sqrt(1.0 * (xs[i] - xs[j]) * (xs[i] - xs[j]) +
                      (ys[i] - ys[j]) * (ys[i] - ys[j]));
      if (!EQ(r - rp, d) && !EQ(r + rp, d) && r - rp < d && r + rp > d)
        ok = false;
      else if (((r - rp > d || EQ(r - rp, d)) && rs[i] > rs[j]) ||
               (r + rp < d || EQ(r + rp, d)))
        soto++;
      else if ((r - rp > d || EQ(r - rp, d)) && rs[i] < rs[j])
        naka++;
      else
        hana++;
    }
    if (ok && ((soto == 2) || (naka == 2) || (hana == 2))) {
      cnt++;
    }
  }
  cout << cnt << endl;
}
int main() {
  solve();
  return 0;
}
