#include <bits/stdc++.h>
using namespace std;
double d = 0;
bool intersect(int, int);
bool belong(int, int);
bool none(int, int);
void solve() {
  int x1, y1, r1, R1, x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int x = abs(x1 - x2);
  int y = abs(y1 - y2);
  d = sqrt(x * x + y * y);
  int ans = 0;
  if (d <= r2 - r1 || d >= r1 + R2 || d <= r1 - R2) ++ans;
  if (d <= r2 - R1 || d >= R1 + R2 || d <= R1 - R2) ++ans;
  if (d <= r1 - r2 || d >= r2 + R1 || d <= r2 - R1) ++ans;
  if (d <= r1 - R2 || d >= R2 + R1 || d <= R2 - R1) ++ans;
  cout << ans << '\n';
}
bool intersect(int r1, int r2) {
  if (d < r1 + r2 && d > max(r1, r2) - min(r1, r2))
    return true;
  else
    return false;
}
bool belong(int r1, int r2) {
  if (d <= r2 - r1)
    return true;
  else
    return false;
}
bool none(int r1, int r2) {
  if (!belong(r1, r2) && !belong(r2, r1) && !intersect(r1, r2))
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
