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