#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int x, y, r;
} Node;
int cross(Node a, Node b) {
  int dis = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
  if (dis >= (a.r + b.r) * (a.r + b.r))
    return 0;
  else if ((a.r - b.r) * (a.r - b.r) >= dis)
    return 2;
  else
    return 1;
}
int contain_by(Node a, Node b) {
  if (a.r <= b.r && cross(a, b) == 2)
    return 1;
  else
    return 0;
}
int main() {
  Node circle[4];
  int x, y, r1, r2;
  scanf("%d%d%d%d", &x, &y, &r1, &r2);
  circle[0].x = x;
  circle[0].y = y;
  circle[0].r = r1;
  circle[1].x = x;
  circle[1].y = y;
  circle[1].r = r2;
  scanf("%d%d%d%d", &x, &y, &r1, &r2);
  circle[2].x = x;
  circle[2].y = y;
  circle[2].r = r1;
  circle[3].x = x;
  circle[3].y = y;
  circle[3].r = r2;
  int ans = 0;
  if (cross(circle[0], circle[3]) == 0 || contain_by(circle[0], circle[2]) ||
      contain_by(circle[3], circle[0]))
    ans++;
  if (cross(circle[2], circle[1]) == 0 || contain_by(circle[2], circle[0]) ||
      contain_by(circle[1], circle[2]))
    ans++;
  if (cross(circle[1], circle[3]) == 0 || contain_by(circle[3], circle[1]) ||
      contain_by(circle[1], circle[2]))
    ans++;
  if (cross(circle[1], circle[3]) == 0 || contain_by(circle[1], circle[3]) ||
      contain_by(circle[3], circle[0]))
    ans++;
  printf("%d\n", ans);
  return 0;
}
