#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long int INF = 1e18;
const int MOD = 1e9 + 7;
long long int GCD(long long int a, long long int b) {
  return b == 0 ? a : GCD(b, a % b);
}
int main() {
  long long int x, y, l, r, ab, b;
  cin >> l >> r >> x >> y;
  ab = x * y;
  int cnt = 0;
  for (long long int i = x; i * i <= ab; i += x) {
    b = ab / i;
    long long int tt = GCD(i, b);
    long long int lc = (i * b) / tt;
    if (lc == y && tt == x && max(i, b) <= r && min(i, b) >= l) {
      if (i != b)
        cnt += 2;
      else
        cnt += 1;
    }
  }
  cout << cnt << endl;
  return 0;
}
