#include <bits/stdc++.h>
using namespace std;
int xa, ya, ra, Ra;
int xb, yb, rb, Rb;
double ioi;
int ans;
double mn, mx;
double dst() { return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)); }
int dnt(int a, int b) {
  double sum = double(a + b);
  if (sum <= ioi)
    return 3;
  else {
    mn = double(min(a, b));
    mx = double(max(a, b));
    if (mn + ioi <= mx) return (mx == a) ? 1 : 2;
  }
  return 0;
}
int main() {
  cin >> xa >> ya >> ra >> Ra;
  cin >> xb >> yb >> rb >> Rb;
  ioi = dst();
  if (dnt(ra, rb) && dnt(ra, Rb) && (dnt(ra, rb) == dnt(ra, Rb))) ans++;
  if (dnt(Ra, rb) && dnt(Ra, Rb) && (dnt(Ra, rb) == dnt(Ra, Rb))) ans++;
  if (dnt(rb, ra) && dnt(rb, Ra) && (dnt(rb, ra) == dnt(rb, Ra))) ans++;
  if (dnt(Rb, ra) && dnt(Rb, Ra) && (dnt(Rb, ra) == dnt(Rb, Ra))) ans++;
  cout << ans;
  return 0;
}
