#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  long long t;
  while (b != 0) {
    t = b;
    b = a % b;
    a = t;
  }
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long brute(int l, int r, int x, int y) {
  long long cnt = 0;
  int start = (l / x) * x;
  if (start < l) start += x;
  for (long long i = start; i < r; i += x)
    for (long long j = i + x; j <= r; j += x)
      if (gcd(i, j) == x && (i * j) / x == y) {
        cnt += 1 + (i != j);
      }
  return cnt;
}
long long ver1(int l, int r, int x, int y) {
  long long cnt = 0;
  int start = (l / x) * x;
  if (start < l) start += x;
  long long mul = x * y;
  for (long long i = start; i < r; i += x)
    for (long long j = i + x; j <= r; j += x)
      if (gcd(i / x, j / x) == 1 && i * j == mul) {
        cnt += 1 + (i != j);
      }
  return cnt;
}
long long ver2(long long l, long long r, long long x, long long y) {
  long long cnt = 0, mul = x * y;
  long long start, least, most;
  least = max(mul / r, l);
  most = min(mul / l, r);
  if (most < least) return 0;
  start = (least / x) * x;
  if (start < l) start += x;
  for (long long i = start; i <= most && i * i <= mul; i += x) {
    if (mul % i) continue;
    long long j = mul / i;
    if (j > r || j < l) continue;
    if (gcd(i, j) == x) cnt += 1 + (i != j);
  }
  return cnt;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  long long l, r, x, y;
  cin >> l >> r >> x >> y;
  long long cnt;
  if (r >= l) {
    cnt = ver2(l, r, x, y);
  }
  cout << cnt << endl;
  return 0;
}
