#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
long long l, r, x, y;
int p[100005];
int prim[100005];
int k = 0;
int f[2][100005];
int n = 0;
vector<long long> v;
void find_prim() {
  p[0] = p[1] = true;
  for (int i = 2; i < max_n; i++) {
    if (!p[i]) {
      prim[k++] = i;
      for (int j = i * 2; j < max_n; j += i) p[j] = true;
    }
  }
}
void fact(int f[][100005], int &cnt) {
  int t = 0;
  int res = 1;
  for (int i = 0; i < k; i++) {
    if (prim[i] > x && prim[i] > y) break;
    f[0][cnt] = f[1][cnt] = 1;
    if (x % prim[i] == 0) {
      t = 0;
      res = 1;
      while (x % prim[i] == 0) x /= prim[i], t++, res *= prim[i];
      f[0][cnt] = res;
    }
    if (y % prim[i] == 0) {
      t = 0;
      res = 1;
      while (y % prim[i] == 0) y /= prim[i], t++, res *= prim[i];
      f[1][cnt] = res;
    }
    if (f[0][cnt] != 1 || f[1][cnt] != 1) {
      cnt++;
    }
  }
  f[0][cnt] = f[1][cnt] = 1;
  if (x != 1) f[0][cnt] = x;
  if (y != 1) f[1][cnt] = y;
  if (f[0][cnt] != 1 || f[1][cnt] != 1) cnt++;
}
void dfs(int now, long long res) {
  if (now == n) {
    v.push_back(res);
    return;
  }
  if (f[0][now] == f[1][now])
    dfs(now + 1, res * f[0][now]);
  else {
    dfs(now + 1, res * f[0][now]);
    dfs(now + 1, res * f[1][now]);
  }
}
int main() {
  scanf("%lld%lld%lld%lld", &l, &r, &x, &y);
  long long temp = x * y;
  find_prim();
  if (y % x)
    printf("0\n");
  else {
    fact(f, n);
    dfs(0, 1);
    long long ans = 0;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] >= l && v[i] <= r && temp / v[i] >= l && temp / v[i] <= r) ans++;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
