#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l, r, x, y, i, j, k, p, a, b, len, s, cnt = 0;
  cin >> l >> r >> x >> y;
  if (x == y && x >= l && x <= r) {
    cout << 1 << '\n';
    return 0;
  }
  if (y % x != 0) {
    cout << 0 << '\n';
    return 0;
  }
  k = y / x;
  j = k;
  vector<long long> v;
  for (i = 2; i < (long long)(sqrt(k)) + 1; i++) {
    p = 1;
    while (j % i == 0) {
      j /= i;
      p *= i;
    }
    if (p != 1) v.emplace_back(p);
  }
  if (j != 1) v.emplace_back(j);
  len = v.size();
  len = pow(2, len);
  long long bit[len];
  for (i = 0; i < len; i++) {
    j = i;
    p = 1;
    s = v.size();
    s--;
    while (j > 0) {
      if (j & 1) p *= v[s];
      j /= 2;
      s--;
    }
    a = p * x;
    b = (x) * (k / p);
    if (a >= l && a <= r && b >= l && b <= r) cnt += 1;
  }
  cout << cnt << '\n';
}
