#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (a > 0 && b > 0) {
    if (a > b) {
      a %= b;
    } else {
      b %= a;
    }
  }
  return a + b;
}
int main() {
  int l = 0;
  cin >> l;
  int r = 0;
  cin >> r;
  int x = 0;
  cin >> x;
  int y = 0;
  cin >> y;
  if (y % x != 0) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  int n = y / x;
  for (int d = 1; d * d <= n; ++d) {
    if (n % d == 0) {
      int mem = n / d;
      if (l <= mem * x && mem * x <= r && l <= d * x && d * x <= r &&
          gcd(mem, d) == 1) {
        if (d * d == n) {
          ans++;
        } else {
          ans += 2;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
