#include <bits/stdc++.h>
using namespace std;
int check(int r1, int r2, int dd) {
  int rr = (r1 + r2) * (r1 + r2);
  if (rr <= dd) return 1;
  if (r1 >= r2) {
    rr = (r1 - r2) * (r1 - r2);
    if (rr >= dd) return 1;
  }
  if (r1 <= r2) {
    rr = (r1 - r2) * (r1 - r2);
    if (rr >= dd) 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;
  int dd = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  if (check(r1, r2, dd) == -1 || check(r1, R2, dd) == 1) ++ans;
  if (check(R1, r2, dd) == -1 || check(R1, R2, dd) == 1) ++ans;
  if (check(r2, r1, dd) == -1 || check(r2, R1, dd) == 1) ++ans;
  if (check(R2, r1, dd) == -1 || check(R2, R1, dd) == 1) ++ans;
  cout << ans << endl;
  return 0;
}
