#include <bits/stdc++.h>
using namespace std;
unsigned long long int Gcd(unsigned long long int a, unsigned long long int b) {
  if (b == 0)
    return a;
  else
    return Gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  unsigned long long int l, r, gcd, lcm;
  cin >> l >> r >> gcd >> lcm;
  unsigned long long int ans = lcm / gcd;
  unsigned long long int sq = sqrt(ans);
  unsigned long long int cnt = 0;
  if (lcm % gcd != 0) {
    cout << 0 << endl;
    return 0;
  }
  for (unsigned long long int i = 1; i <= sq; i++) {
    if (ans % i == 0) {
      if ((ans / i) * gcd >= l and (ans / i) * gcd <= r and i * gcd >= l and
          i * gcd <= r) {
        unsigned long long int check = Gcd(ans / i, i);
        if (check != 1) continue;
        ++cnt;
        if (ans != i * i) ++cnt;
      }
    }
  }
  cout << cnt;
  return 0;
}
