#include <bits/stdc++.h>
long double eps = 0.000000001;
using namespace std;
map<long long, long long> mp;
vector<long long> v;
long long hcf(long long x, long long y) {
  if (y == 0) return x;
  return hcf(y, x % y);
}
int main() {
  long long l, r, gcd, lcm;
  cin >> l >> r >> gcd >> lcm;
  int ans = 0;
  long long num = lcm / gcd;
  if (lcm % gcd != 0) {
    cout << 0;
    return 0;
  }
  for (long long i = 1; i * i <= num; i++) {
    if (num % i != 0) continue;
    if (hcf(i, num / i) != 1) continue;
    long long other = gcd * (num / i);
    if (gcd * i >= l and gcd * i <= r and other >= l and other <= r) {
      long long fir = gcd * i;
      if (fir != other)
        ans += 2;
      else
        ans++;
    }
  }
  cout << ans << endl;
}
