#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long l, r, x, y;
  cin >> l >> r >> x >> y;
  if (x == y) {
    if (x >= l && x <= r)
      cout << 1;
    else
      cout << 0;
    return 0;
  }
  long long cnt = 0;
  for (long long i = 1; i * i <= y; i++) {
    if (y % i == 0) {
      if (i % x == 0 && i >= l && i <= r && (y * x / i) >= l &&
          (y * x / i) <= r && gcd(i, y * x / i) == x)
        cnt += 1;
      if ((y / i) % x == 0 && i * x >= l && i * x <= r && (y / i) >= l &&
          (y / i) <= r && gcd(i * x, y / i) == x)
        cnt += 1;
    }
  }
  long long p = (long long)sqrt(y);
  if (p * p == y && p == x && p >= l && p <= r && p * x >= l && p * x <= r)
    cnt--;
  cout << cnt;
}
