#include <bits/stdc++.h>
using namespace std;
double dis(double x1, double y1, double x2, double y2) {
  double xx = x1 - x2, yy = y1 - y2;
  return sqrt(xx * xx + yy * yy);
}
int can(double x1, double y1, double r1, double x2, double y2, double r2) {
  double dst = dis(x1, y1, x2, y2);
  if (dst + 1e-8 > r1 + r2) return 1;
  if (dst + r1 < r2 + 1e-8) return 2;
  if (dst + r2 < r1 + 1e-8) return 3;
  return 0;
}
int main() {
  double x1, y1, r1, R1;
  double x2, y2, r2, R2;
  while (cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2) {
    double x[6], y[6], r[6];
    int i, j;
    for (i = 1; i <= 2; i++) x[i] = x1;
    for (i = 1; i <= 2; i++) y[i] = y1;
    for (i = 3; i <= 4; i++) x[i] = x2;
    for (i = 3; i <= 4; i++) y[i] = y2;
    r[1] = r1, r[2] = R1, r[3] = r2, r[4] = R2;
    int G[6][6];
    memset(G, 0, sizeof(G));
    for (i = 1; i <= 4; i++)
      for (j = 1; j <= 4; j++)
        G[i][j] = can(x[i], y[i], r[i], x[j], y[j], r[j]);
    int ans = 4;
    if (!G[1][3] || !G[1][4] || (G[3][1] == 2 && G[1][4] == 2) ||
        (G[1][3] == 1 && G[1][4] == 2))
      ans--;
    if (!G[2][3] || !G[2][4] || (G[3][2] == 2 && G[2][4] == 2) ||
        (G[2][3] == 1 && G[2][4] == 2))
      ans--;
    if (!G[3][1] || !G[3][2] || (G[1][3] == 2 && G[3][2] == 2) ||
        (G[3][1] == 1 && G[3][2] == 2))
      ans--;
    if (!G[4][1] || !G[4][2] || (G[1][4] == 2 && G[4][2] == 2) ||
        (G[4][1] == 1 && G[4][2] == 2))
      ans--;
    cout << ans << endl;
  }
  return 0;
}
