#include <bits/stdc++.h>
using namespace std;
bool noCollide(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
  int d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  int rd1 = (r1 - r2) * (r1 - r2);
  int rd2 = (r1 + r2) * (r1 + r2);
  int Rd1 = (r1 - R2) * (r1 - R2);
  int Rd2 = (r1 + R2) * (r1 + R2);
  if (d <= rd1 && d <= Rd1 && (r1 <= r2 || r1 >= R2)) return 1;
  if (rd2 <= d && Rd2 <= d) return 1;
  return 0;
}
int main() {
  int x1, y1, r1, R1;
  int x2, y2, r2, R2;
  cin >> x1 >> y1 >> r1 >> R1;
  cin >> x2 >> y2 >> r2 >> R2;
  int ans = 0;
  if (noCollide(x1, y1, r1, x2, y2, r2, R2)) ans++;
  if (noCollide(x1, y1, R1, x2, y2, r2, R2)) ans++;
  if (noCollide(x2, y2, r2, x1, y1, r1, R1)) ans++;
  if (noCollide(x2, y2, R2, x1, y1, r1, R1)) ans++;
  cout << ans << endl;
}
