#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long mod = (1e9) + 7;
long long int l, r, x, y;
long long int gcd(long long int n1, long long int n2) {
  return (n2 == 0) ? n1 : gcd(n2, n1 % n2);
}
map<int, int> m;
bool ok(long long int c) { return c >= l && c <= r; }
int main() {
  cin >> l >> r >> x >> y;
  if (y % x) {
    cout << 0;
    return 0;
  }
  l = ceil(l * 1.0 / x);
  r /= x;
  long long int a = y / x;
  long long int cnt = 0;
  long long int c = sqrt(a);
  for (long long int i = 1; i <= c; i++) {
    if (a % i == 0) {
      long long int g = gcd(i, a / i);
      if (ok(i) && ok(a / i) && g == 1) {
        cnt += 2;
        if (i == a / i) cnt--;
      }
    }
  }
  cout << cnt;
  return 0;
}
