#include <bits/stdc++.h>
using namespace std;
int n, l, r, x, y, o, e, w, z, b[50000], aa, bb, ans;
vector<int> vec;
map<int, int> ma;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> l >> r >> x >> y;
  if (y % x != 0) {
    cout << 0 << endl;
    return 0;
  } else
    y /= x;
  for (int i = 2; i * i <= y; i++)
    if (y % i == 0) {
      vec.push_back(i);
      while (y % i == 0) {
        y /= i;
        ma[i]++;
      }
    }
  if (y > 1) {
    vec.push_back(y);
    ma[y]++;
  }
  z = vec.size();
  for (int i = 0; i < (1 << z); i++) {
    w = i;
    for (int j = 0; j < z; j++) b[j] = 0;
    o = 0;
    while (w) {
      b[o] = w & 1;
      w >>= 1;
      o++;
    }
    aa = bb = 1;
    for (int j = 0; j < z; j++)
      if (b[j] == 1) {
        e = ma[vec[j]];
        for (int h = 1; h <= e; h++) aa *= vec[j];
      } else {
        e = ma[vec[j]];
        for (int h = 1; h <= e; h++) bb *= vec[j];
      }
    if (l <= aa * x && aa * x <= r && l <= bb * x && bb * x <= r) ans++;
  }
  cout << ans << endl;
  return 0;
}
