#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
vector<ll> dv;
void divisor(ll n) {
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      if (i == n / i) {
        dv.push_back(i);
      } else {
        dv.push_back(i);
        dv.push_back(n / i);
      }
    }
  }
}
ll gcd(ll a, ll b) {
  if (a == 0 || b == 0) return 0;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  ll l, r, x, y;
  cin >> l >> r >> x >> y;
  if (y % x != 0)
    cout << 0 << endl;
  else {
    ll tmp = y / x;
    divisor(tmp);
    ll ans = 0;
    for (auto &z : dv) {
      ll a = z;
      ll b = tmp / z;
      if (gcd(a, b) == 1) {
        if (l <= x * a && x * a <= r && l <= x * b && x * b <= r) ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
