#include <bits/stdc++.h>
using namespace std;
vector<long long> tell(long long n) {
  vector<long long> v;
  if (!(n % 2)) {
    long long x = 1;
    while (!(n % 2)) {
      x *= 2;
      n /= 2;
    }
    v.push_back(x);
  }
  for (int i = 3; i * i <= n; i = i + 2) {
    if (!(n % i)) {
      long long x = 1;
      while (!(n % i)) {
        x *= i;
        n /= i;
      }
      v.push_back(x);
    }
  }
  if (n > 2) v.push_back(n);
  return v;
}
int main() {
  long long l, r, x, y, t, ans = 0;
  cin >> l >> r >> x >> y;
  t = x * y;
  if (y % x) {
    cout << 0;
    return 0;
  }
  vector<long long> v = tell(y / x);
  long long sz = v.size();
  sz = (1 << sz);
  for (long long i = 0; i < sz; i++) {
    long long k = i, j = 0, p = 1;
    while (k) {
      if (k & 1) p *= (v[j]);
      k >>= 1;
      j++;
    }
    p *= x;
    long long mx = max(p, (t / p));
    long long mn = min(p, (t / p));
    if (l <= mn && mx <= r) ans++;
  }
  cout << ans;
  return 0;
}
