#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  long long int l, r, x, y, i, j;
  cin >> l >> r >> x >> y;
  map<long long int, int> m;
  for (i = 1; i <= sqrt(x); i++) {
    if (x % i == 0) {
      m[i] = 1;
      m[x / i] = 1;
    }
  }
  for (i = 1; i <= sqrt(y); i++) {
    if (y % i == 0) {
      m[i] = 1;
      m[y / i] = 1;
    }
  }
  long long int count = 0;
  long long int p = x * y;
  for (auto it = m.begin(); it != m.end(); it++) {
    long long int a = it->first;
    long long int b = p / a;
    if (a >= l && a <= r && b >= l && b <= r) {
      long long int r = gcd(a, b);
      if (r == x) count++;
    }
  }
  cout << count << endl;
}
