#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main() {
  int l, r, x, y, output;
  int i, a, j;
  while (scanf("%d%d%d%d", &l, &r, &x, &y) != EOF) {
    if (y % x != 0) {
      printf("0\n");
      continue;
    }
    a = y / x;
    output = 0;
    for (i = 1; i * i <= a; i++) {
      j = a / i;
      if (i * x >= l && a % i == 0 && a / i * x <= r && gcd(i, a / i) == 1) {
        if (i == j)
          output = output + 1;
        else
          output = output + 2;
      }
    }
    printf("%d\n", output);
  }
  return 0;
}
