#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  long long int l, r, x, y;
  cin >> l >> r >> x >> y;
  if (y % x != 0)
    cout << 0 << endl;
  else {
    long long int val = y / x, lval = l / x, rval = r / x, ans = 0;
    if (l % x != 0) lval++;
    for (long long int i = 1; i <= sqrt(val); i++) {
      if (val % i == 0) {
        if (i * i == val && i >= lval && i <= rval && i == 1) {
          ans++;
          continue;
        }
        if (gcd(i, val / i) == 1 && i >= lval && i <= rval && val >= i * lval &&
            val <= i * rval)
          ans += 2;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
