#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("trapv")
long long mxm() { return LLONG_MIN; }
template <typename... Args>
long long mxm(long long a, Args... args) {
  return max(a, mxm(args...));
}
long long mnm() { return LLONG_MAX; }
template <typename... Args>
long long mnm(long long a, Args... args) {
  return min(a, mnm(args...));
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
bool isprime(long long n) {
  if (n <= 1) {
    return false;
  }
  if (n <= 3) {
    return true;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    return false;
  }
  for (int i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
bool isprimeMR(long long n) {
  if (n < 2) {
    return false;
  }
  for (long long x : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}) {
    if (n == x) return true;
    bool flag = true;
    long long r = 1;
    long long t = 1;
    while (r <= ((n - 1) >> __builtin_ctzll(n - 1))) {
      if (r & ((n - 1) >> __builtin_ctzll(n - 1))) t = (t * x) % n;
      x = (x * x) % n;
      r <<= 1;
    }
    if (t == 1 || t == n - 1) flag = false;
    for (r = 0; r < __builtin_ctzll(n - 1); r++) {
      t = (t * t) % n;
      if (t == n - 1) flag = false;
    }
    if (flag) return false;
  }
  return true;
}
bool prime[1000001];
void sieve() {
  long long n = 1000000;
  memset(prime, true, sizeof(prime));
  prime[1] = false;
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
long long power(long long x, long long y) {
  if (y == 0) {
    return 1;
  }
  long long p = power(x, y / 2);
  p = (p * p);
  return (y % 2 == 0) ? p : (x * p);
}
long long powm(long long x, long long y, long long m) {
  long long ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y) {
    if (r & y) {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long lar = max(a, b);
  long long small = min(a, b);
  for (long long i = lar;; i += lar) {
    if (i % small == 0) {
      return i;
    }
  }
}
bool sortbysec(const pair<long long, long long>& a,
               const pair<long long, long long>& b) {
  return (a.second < b.second);
}
bool sortbydec(const pair<long long, long long>& a,
               const pair<long long, long long>& b) {
  return (a.first > b.first);
}
void dex(int a) {
  if (a == 1) {
    cout << "YES";
  }
  if (a == 2) {
    cout << "NO";
  }
  if (a == 3) {
    cout << "Yes";
  }
  if (a == 4) {
    cout << "No";
  }
}
long long mod(long long n, long long MOD) {
  n = (n + MOD) % MOD;
  return n;
}
const long long N = (long long)(1e5 + 1);
const long long MOD = (long long)(1e9 + 7);
const long long INF = (long long)(2e18);
bool check(long long x, long long l, long long r) {
  if (x >= l && x <= r) {
    return true;
  }
  return false;
}
void solve(long long tc) {
  long long l, r, x, y;
  cin >> l >> r >> x >> y;
  set<long long> s;
  for (long long i = 1; i * i <= y; i++) {
    if (y % i == 0) {
      s.insert(i);
      s.insert(y / i);
    }
  }
  long long ans = 0;
  set<pair<long long, long long> > s2;
  for (auto& it1 : s) {
    for (auto& it2 : s) {
      if (lcm(it1, it2) == y && gcd(it1, it2) == x && check(it1, l, r) &&
          check(it2, l, r)) {
        s2.insert({it1, it2});
        s2.insert({it2, it1});
      }
    }
  }
  cout << (long long)s2.size();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long cnt = 1;
  long long t = 1;
  while (t--) {
    solve(cnt);
    cnt++;
  }
  return 0;
}
