#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger& operator,(const T v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
map<long long, long long> factors(long long n) {
  map<long long, long long> res;
  while (n % 2 == 0) {
    if (res.find(2) == res.end())
      res[2] = 2;
    else
      res[2] *= 2;
    n = n / 2;
  }
  for (long long i = 3; i * i <= n; i = i + 2) {
    while (n % i == 0) {
      if (res.find(i) == res.end())
        res[i] = i;
      else
        res[i] *= i;
      n = n / i;
    }
  }
  if (n > 2) {
    if (res.find(n) == res.end())
      res[n] = n;
    else
      res[n] *= n;
  }
  return res;
}
long long ans = 0;
long long l, r, x, y;
vector<int> parts;
void f(long long i, long long now) {
  if (i >= parts.size()) {
    long long a = now;
    long long b = (y / now);
    a *= x;
    if (a >= l && a <= r && b >= l && b <= r) {
      ans++;
    }
    return;
  }
  f(i + 1, now);
  f(i + 1, now * parts[i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> l >> r >> x >> y;
  if (y % x != 0) {
    cout << 0 << "\n";
    return 0;
  }
  long long yy = y / x;
  map<long long, long long> prm = factors(yy);
  for (auto it : prm) {
    parts.push_back(it.second);
  }
  f(0, 1);
  cout << ans << "\n";
  return 0;
}
