#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  char ch = getchar();
  int f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  x *= f;
}
long long L, R, x, y;
long long gcd(long long x, long long y) {
  if (!y)
    return x;
  else
    return gcd(y, x % y);
}
long long solve(long long l, long long r) {
  long long t = y / x, res = 0;
  for (long long i = 1; i * i <= t; ++i) {
    if (t % i == 0) {
      long long a = i, b = t / i;
      if (l <= a * x && a * x <= r && l <= b * x && b * x <= r &&
          gcd(a, b) == 1) {
        if (a == b)
          res++;
        else
          res += 2;
      }
    }
  }
  return res;
}
int main() {
  scanf("%lld %lld %lld %lld\n", &L, &R, &x, &y);
  if (y % x != 0) {
    printf("0\n");
    return 0;
  } else
    printf("%lld\n", solve(L, R));
  return 0;
}
