#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int l, r, x, y, a, b, tmp;
  cin >> l >> r >> x >> y;
  l = max(l, x);
  r = min(r, y);
  if (l > r || y % x != 0) return puts("0"), 0;
  int sum = y / x, ans = 0;
  for (int k = l / x; k <= r / x && k * k <= sum; k++) {
    if (sum % k == 0) {
      tmp = sum / k;
      if (k * x >= l && k * x <= r && tmp * x >= l && tmp * x <= r)
        if (gcd(k, tmp) == 1) ans += (k == tmp ? 1 : 2);
    }
  }
  cout << ans << endl;
  return 0;
}
