#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
struct CIRCLE {
  int x;
  int y;
  int r;
};
int x1, y1_, r1, R1;
int x2, y2_, r2, R2;
float dist(CIRCLE from, CIRCLE to) {
  return sqrt(pow(from.x - to.x, 2) + pow(from.y - to.y, 2));
}
bool inter(CIRCLE A, CIRCLE B) {
  if (dist(A, B) >= A.r + B.r) return false;
  if (max(A.r, B.r) > dist(A, B))
    return (max(A.r, B.r) < dist(A, B) + min(A.r, B.r));
  return true;
}
bool in(CIRCLE from, CIRCLE to) { return (dist(from, to) + from.r <= to.r); }
bool out(CIRCLE from, CIRCLE to) { return in(to, from); }
int main(int argc, char **argv) {
  cin >> x1 >> y1_ >> r1 >> R1;
  cin >> x2 >> y2_ >> r2 >> R2;
  CIRCLE A1 = {x1, y1_, r1};
  CIRCLE A2 = {x1, y1_, R1};
  CIRCLE B1 = {x2, y2_, r2};
  CIRCLE B2 = {x2, y2_, R2};
  int res = 0;
  if ((dist(A1, B2) >= A1.r + B2.r) || (in(A1, B1) || out(A1, B2))) res++;
  if ((dist(A2, B2) >= A2.r + B2.r) || (in(A2, B1) || out(A2, B2))) res++;
  if ((dist(B1, A2) >= B1.r + A2.r) || (in(B1, A1) || out(B1, A2))) res++;
  if ((dist(B2, A2) >= B2.r + A2.r) || (in(B2, A1) || out(B2, A2))) res++;
  cout << res << endl;
}
