#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 1000005;
int SetBit(int n, int x) { return n | (1 << x); }
int ClearBit(int n, int x) { return n & ~(1 << x); }
int ToggleBit(int n, int x) { return n ^ (1 << x); }
bool CheckBit(int n, int x) { return (bool)(n & (1 << x)); }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main(void) {
  long long l, r, a, b, x, y, G, L, i, j;
  while (scanf("%lld %lld %lld %lld", &l, &r, &a, &b) != EOF) {
    vector<int> v;
    for (i = 1; i * i <= b; i++) {
      if (b % i == 0) {
        v.push_back(i);
        if (i != b / i) v.push_back(b / i);
      }
    }
    sort(v.begin(), v.end());
    int len = v.size();
    int ans = 0;
    for (i = 0; i < len; i++) {
      for (j = 0; j < len; j++) {
        x = v[i], y = v[j];
        G = gcd(x, y);
        L = (x * y) / G;
        if (G == a && L == b && x >= l && x <= r && y >= l && y <= r) ++ans;
      }
    }
    printf("%d\n", ans);
    v.clear();
  }
  return 0;
}
