#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, int> mapp;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long x, y, l, r;
  cin >> l >> r >> x >> y;
  long long sq = sqrt(y);
  for (long long i = 1; i <= sq; i++) {
    if (y % i == 0) {
      long long t = y / i;
      long long w = i * x;
      long long gcdd = gcd(t, w);
      long long lcm = t / gcdd * w;
      if (t >= l && t <= r && w >= l && w <= r && gcdd == x && lcm == y) {
        mapp[make_pair(t, w)] = 1;
        mapp[make_pair(w, t)] = 1;
      }
      t = y / (y / i);
      w = (y / i) * x;
      gcdd = gcd(t, w);
      lcm = t / gcdd * w;
      if (t >= l && t <= r && w >= l && w <= r && gcdd == x && lcm == y) {
        mapp[make_pair(t, w)] = 1;
        mapp[make_pair(w, t)] = 1;
      }
    }
  }
  cout << mapp.size() << endl;
  return 0;
}
