#include <bits/stdc++.h>
using namespace std;
map<long long, long long> fac(long long x) {
  map<long long, long long> ans;
  while (true) {
    bool found = false;
    for (int i = 2; i < int(sqrt(x) + 2); ++i) {
      if (x % i == 0) {
        found = true;
        ans[i]++;
        x /= i;
        break;
      }
    }
    if (!found) break;
  }
  ans[x]++;
  return ans;
}
int main() {
  cin.sync_with_stdio(false);
  long long l, r, x, y;
  cin >> l >> r >> x >> y;
  map<long long, pair<long long, long long> > m;
  for (auto a : fac(x)) {
    m[a.first].first = a.second;
  }
  for (auto a : fac(y)) {
    m[a.first].second = a.second;
  }
  vector<tuple<long long, long long, long long> > v;
  long long start = 1;
  for (auto a : m) {
    long long pw1 = 1;
    for (int i = 0; i < int(a.second.first); ++i) pw1 *= a.first;
    long long pw2 = 1;
    for (int i = 0; i < int(a.second.second); ++i) pw2 *= a.first;
    if (pw1 > pw2) {
      cout << 0 << endl;
      return 0;
    }
    if (pw1 == pw2)
      start *= pw1;
    else
      v.emplace_back(a.first, pw1, pw2);
  }
  long long ans = 0;
  for (int mask = 0; mask < int((1 << v.size())); ++mask) {
    long long num1 = start;
    long long num2 = start;
    for (int i = 0; i < int(v.size()); ++i) {
      long long base, a, b;
      tie(base, a, b) = v[i];
      if (mask & (1 << i)) {
        num1 *= a;
        num2 *= b;
      } else {
        num1 *= b;
        num2 *= a;
      }
    }
    if (num1 >= l && num1 <= r && num2 >= l && num2 <= r) ans++;
  }
  cout << ans << endl;
}
