#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long l, long long r) {
  if (r == 0) return 1;
  unsigned long long res = bigmod(l, r / 2) % 1000000007;
  res = (res * res) % 1000000007;
  if (r & 1) res = (res * l) % 1000000007;
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, l, k, q, n, m, a, b, p;
  while (cin >> a >> b >> n >> m) {
    if (m % n)
      cout << "0" << endl;
    else {
      m /= n;
      p = 0;
      for (i = 1; i <= sqrt(m + .5); i++) {
        if (m % i == 0 && gcd(m / i, i) == 1) {
          if (i * n >= a && i * n <= b && n * (m / i) >= a &&
              n * (m / i) <= b) {
            p += 2;
            if (i == m / i) p--;
          }
        }
      }
      cout << p << endl;
    }
  }
  return 0;
}
