#include <bits/stdc++.h>
using namespace std;
const long long MAX = 100007;
long long inf = 1000000000;
long long n, m;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long x, y, l, r;
  cin >> l >> r;
  cin >> x >> y;
  if (y % x != 0) {
    cout << 0 << "\n";
    return 0;
  }
  y /= x;
  vector<pair<long long, long long>> kek;
  long long i = 1;
  while (i * i <= y) {
    if (!(y % i)) {
      kek.push_back({i, y / i});
    }
    i++;
  }
  long long ans = 0;
  for (int i = 0; i < kek.size(); i++) {
    if (gcd(kek[i].first, kek[i].second) == 1 && kek[i].first * x >= l &&
        kek[i].second * x <= r) {
      ans += 2;
      if (kek[i].first == kek[i].second) ans--;
    }
  }
  cout << ans;
  return 0;
}
