#include <bits/stdc++.h>
using namespace std;
int Min(int x, int y) { return (x - y) * (x - y); }
int main() {
  int x1, y1, x2, y2, R1, R2, r1, r2;
  int z;
  scanf("%d%d%d%d", &x1, &y1, &r1, &R1);
  scanf("%d%d%d%d", &x2, &y2, &r2, &R2);
  int ans = 0;
  int l = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  if (l >= (R1 + R2) * (R1 + R2))
    ans++;
  else if (R1 > R2 && l <= (R1 - R2) * (R1 - R2))
    ans++;
  else if (R1 < r2 && l <= (R1 - r2) * (R1 - r2))
    ans++;
  if (l >= (R1 + R2) * (R1 + R2))
    ans++;
  else if (l >= (r1 + R2) * (r1 + R2))
    ans++;
  else if (r1 > R2 && l <= (r1 - R2) * (r1 - R2))
    ans++;
  else if (r1 < r2 && l <= (r1 - r2) * (r1 - r2))
    ans++;
  if (l >= (R1 + R2) * (R1 + R2))
    ans++;
  else if (R2 > R1 && l <= (R1 - R2) * (R1 - R2))
    ans++;
  else if (R2 < r1 && l <= (R2 - r1) * (R2 - r1))
    ans++;
  if (l >= (R1 + R2) * (R1 + R2))
    ans++;
  else if (l >= (r2 + R1) * (r2 + R1))
    ans++;
  else if (r2 > R1 && l <= (r2 - R1) * (r2 - R1))
    ans++;
  else if (r2 < r1 && l <= (r1 - r2) * (r1 - r2))
    ans++;
  printf("%d\n", ans);
  return 0;
}
