#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gcd(T a, T b) {
  T c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long l, r, x, y;
  cin >> l >> r >> x >> y;
  long long ab = x * y;
  vector<long long> divx, divy;
  for (long long i = 1; i * i <= x; i++)
    if (x % i == 0) {
      divx.push_back(i);
      if (i * i != x) divx.push_back(x / i);
    }
  for (long long i = 1; i * i <= y; i++)
    if (y % i == 0) {
      divy.push_back(i);
      if (i * i != y) divy.push_back(y / i);
    }
  set<long long> div;
  for (long long dx : divx)
    for (long long dy : divy) div.insert(dx * dy);
  set<pair<long long, long long> > par;
  for (long long z : div)
    if (gcd(z, ab / z) == x and l <= z and z <= r and l <= ab / z and
        ab / z <= r)
      par.insert({z, ab / z});
  cout << par.size() << endl;
  return 0;
}
