#include <bits/stdc++.h>
using namespace std;
int l, r, x, y;
vector<int> primes;
int cnt(int idx, int a, int b) {
  if (idx == primes.size()) return a >= l && a <= r && b >= l && b <= r;
  return cnt(idx + 1, a * primes[idx], b) + cnt(idx + 1, a, b * primes[idx]);
}
int main() {
  cin >> l >> r >> x >> y;
  if (y % x) return puts("0");
  y /= x;
  for (int i = 2; i * i <= y; i++) {
    int v = 1;
    while (y % i == 0) y /= i, v *= i;
    if (v > 1) primes.push_back(v);
  }
  if (y > 1) primes.push_back(y);
  cout << cnt(0, x, x);
}
