#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  double x1, y1, r1, R1, x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int ans = 0;
  double dx = (x1 - x2) * (x1 - x2);
  double dy = (y1 - y2) * (y1 - y2);
  double dist = sqrt(dx + dy);
  if (dist + r1 <= r2)
    ans++;
  else if (r1 + R2 <= dist)
    ans++;
  else if (dist + R2 <= r1)
    ans++;
  if (dist + R1 <= r2)
    ans++;
  else if (R1 + R2 <= dist)
    ans++;
  else if (dist + R2 <= R1)
    ans++;
  if (dist + r2 <= r1)
    ans++;
  else if (r2 + R1 <= dist)
    ans++;
  else if (dist + R1 <= r2)
    ans++;
  if (dist + R2 <= r1)
    ans++;
  else if (R2 + R1 <= dist)
    ans++;
  else if (dist + R1 <= R2)
    ans++;
  cout << ans;
}
