#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a > b) swap(a, b);
  long long int i;
  long long int cnt = 1;
  for (i = 1; i * i <= a; i++)
    if (a % i == 0) {
      if (b % i == 0) cnt = max(cnt, i);
      if (b % (a / i) == 0) cnt = max(cnt, (a / i));
    }
  return cnt;
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n = 0, m = 0, k = 0, i = 0, j = 0, p = 0, q = 0, x = 0, y = 0,
                  z = 0, ans = 0, cnt = 0, l = 0, r = 0, mid = 0, lo = 0,
                  hi = 0;
    string s;
    bool flag = false;
    cin >> l >> r >> x >> y;
    m = y / x;
    if (y % x == 0) {
      for (i = 1; i * i <= m; i++)
        if (m % i == 0 && gcd(i, m / i) == 1) {
          if (i * x >= l && (m / i) * x <= r) {
            cnt += 2;
            if (i == (m / i)) cnt--;
          }
        }
    }
    cout << cnt << endl;
    ;
  }
  return 0;
}
