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