//package codeforces.Round489;

import java.util.Scanner;

public class NastyaStudiesInformatics {
    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        long l = s.nextLong();
        long r = s.nextLong();
        long x = s.nextLong();
        long y = s.nextLong();

        long res = 0;
        if (y % x == 0) {
            long n = y/x;
            for (int d = 1; d*d <= n; d++) {
                if (n % d == 0) {
                    long c = n / d;
                    if (l <= c * x && c * x <= r && l <= d * x && d * x <= r && gcd(c, d) == 1) {
                        if (d * d == n) res++;
                        else res += 2;
                    }
                }
            }
        }
        System.out.println(res);

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	public static Scanner cin = new Scanner(System.in);
	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter pw = new PrintWriter(System.out);
	StringTokenizer st = null;
//	List<List<Long>> list;
	long MOD = 998244353L;
	static long MAX = (long)1e12;
	int n, m;
	int a[], b[];
	List<AC> ans = null;
	int c;
	StringBuffer sb = new StringBuffer();
	List<String> list;
	long ax, ay;
	class AC {
		int x, y;
		public AC(int i, int j) {
			x = i;
			y = j;
		}
	};

	public boolean wf(String s) {
		for (String str : list) {
			int c = 0;
			for (int i = 0; i < s.length(); i++) {
				if (str.charAt(i) != s.charAt(i)) {
					c++;
					if (c > 1) return false;
				}
			}
		}
		return true;
	}
	public void solve() throws Exception {
		long l = cin.nextLong();
		long r = cin.nextLong();
		long x = cin.nextLong();
		long y = cin.nextLong();
		if (y % x != 0) {
			System.out.println(0);
			return;
		}
		long k = y / x;
		int ans = 0;
		for (long i = 1; i * i <= k; i++) {
			if (k % i == 0 && i*x >= l && i*x <= r && k / i*x>= l && k / i*x <= r) {
				long g = gcd(i, k / i);
				if (g == 1) {
					ans++;
					if (i * i < k) {
						ans++;
					}
				}
			}
		}
		System.out.println(ans);
	}
	class GCDOBJ {
		long x, y;
	}
	long gcd(long x, long y) {
		if (x % y == 0) {
			return y;
		}
		return gcd(y, x % y);
	}
	long extended_gcd(long a, long b, GCDOBJ obj) {
		long ret, tmp;
		if (b == 0) {
			obj.x = 1;
			obj.y = 0;
			return a;
		}
		ret = extended_gcd(b, a % b, obj);
		tmp = obj.x;
		obj.x = obj.y;
		obj.y = tmp - a / b * obj.y;
		return ret;
	}

	long getRs(long a, long b, long n) {
		GCDOBJ obj = new GCDOBJ();
		long d = extended_gcd(a, n, obj);
		long x0 = obj.x * (b / d) % n;
		if (x0 < 0) {
			x0 += n;
		}
		return x0;
	}
	public static void main(String [] args) {
		Main t = new Main();
//		int tc = cin.nextInt();
		try {
//			while (tc-- > 0)  {
			while (cin.hasNext()) {
				t.solve();
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		t.pw.close();
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BNastyaStudiesInformatics solver = new BNastyaStudiesInformatics();
        solver.solve(1, in, out);
        out.close();
    }

    static class BNastyaStudiesInformatics {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            long l = in.scanLong();
            long r = in.scanLong();
            long x = in.scanLong();
            long y = in.scanLong();
            if (y % x != 0) {
                out.println(0);
                return;
            }
            long ans = 0;
            for (long i = 1; i * i <= y; i++) {
                if (y % i == 0) {
                    long tempb = (x * y) / i;
                    if (CodeHash.gcd(tempb, i) == x) {
                        if (tempb == tempb && l <= i && i <= r && l <= tempb && tempb <= r) {
                            ans++;
                        }
                    }
                    if (i * i != y) {
                        long t = y / i;
                        long tempb2 = (x * y) / t;
                        if (CodeHash.gcd(tempb2, t) == x) {
                            if (tempb2 == tempb2 && l <= t && t <= r && l <= tempb2 && tempb2 <= r) {
                                ans++;
                            }
                        }
                    }
                }
            }
            out.println(ans);

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

    }

    static class CodeHash {
        public static long gcd(long a, long b) {
            if (b == 0)
                return a;
            else
                return gcd(b, a % b);
        }

    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {
    static final long INF = (long) 1e18;
    static final short UNCALC = -1;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        out.flush();
        int l = sc.nextInt();
        int r = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        if (y % x != 0) {
            System.out.println(0);
            return;
        }
        long ans = 0;
        int n = y / x;
        for (int i = 1; 1l * i * i <= n; i++) {
            if (n % i != 0) continue;
            long one = 1l * i * x;
            long two = 1l * (n / i) * (x);
            if (one >= l && one <= r && two >= l && two <= r && isComprime(i,n/i)) {
                ans += 2;
                if (one == two) ans--;
            }

        }
        out.println(ans);
        out.close();
        out.flush();
    }

    static boolean isComprime(int n, int m) {
        return gcd(n, m) == 1;
    }

    static int gcd(int n, int m) {
        return m == 0 ? n : gcd(m, n % m);
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        public Scanner(String file) throws Exception {
            br = new BufferedReader(new FileReader(file));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public boolean ready() throws IOException {
            return br.ready();
        }

        public void waitForInput() throws InterruptedException {
            Thread.sleep(3000);
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        long l = in.nextInt();
        long r = in.nextInt();
        long x = in.nextInt();
        long y = in.nextInt();
/*
        if (y%x != 0){
            out.println(0);
            return;
        }

        if (x >= r || y <= l){
            out.println(0);
            return;
        }
*/
        boolean minus = false;
        long ans = 0;
        for (long a = x; a <= Math.sqrt(x*y); a+=x) {
            long b = x*y/a;
            debug.print(a + " " + b);

            if (a >= l && a <= r && b >= l && b <= r){
                debug.print(" +");

                    if (gcd(a,b)==x && lcm(a,b)==y){
                        debug.print(" +");

                        if (a == b) minus = true;
                        ans++;
                    }
            }

            debug.println("");
        }

        ans *= 2;
        if (minus) ans--;
        out.println(ans);
    }

    static long gcd (long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }

    static long lcm (long a, long b) {
        return a / gcd (a, b) * b;
    }

    public static final String NAME = "";

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            if (NAME.length() > 0) {
                in = new InputReader(new BufferedReader(new FileReader(NAME + ".in")));
                out = new PrintWriter(new FileWriter(NAME + ".out"));
            } else {
                in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            debug = new DebugWriter(false);
            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException{
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class NastyaStudiesInformatics {
    void solve() {
        int l = in.nextInt(), r = in.nextInt(), x = in.nextInt(), y = in.nextInt();

        if (y % x != 0) {
            out.println(0);
            return;
        }

        int ans = 0, t = y / x;
        int sqrt = (int) (Math.sqrt(t) + 0.5);
        for (int i = 1; i <= sqrt; i++) {
            if (t % i == 0 && i * x >= l && i * x <= r) {
                int j = t / i;
                if (j * x >= l && j * x <= r && gcd(i, j) == 1) {
                    ans++;
                    if (j != i) ans++;
                }
            }
        }
        out.println(ans);
    }

    int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new NastyaStudiesInformatics().solve();
        out.close();
    }

    static FastScanner in;
    static PrintWriter out;

    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;

        public FastScanner(BufferedReader in) {
            this.in = in;
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}

import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class goodPairs {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt(), r = scanner.nextInt(), x = scanner.nextInt(), y = scanner.nextInt();

        int count = 0;
        int s = y/x;
        long start, end;
        if(y%x != 0)
            System.out.print(0);
        else {
            for (int i = 1; i * i <= s; i++) {
//            if(i >= l && h%i == 0 && gcd(i, h/i) == x)
//                count++;
                if (s % i == 0) {
                    int divided = s / i;
                    int candidate1 = divided * x;
                    int candidate2 = i * x;
                    if (candidate1 >= l && candidate1 <= r && candidate2 >= l && candidate2 <= r && gcd(divided, i) == 1) {
                        if(!(i*i == s))
                            count += 2;
                        else
                            count++;
                    }
                }
            }

            System.out.println(count);
        }
    }

    private static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a%b);
    }

    private static int lcm(int a, int b, int gcd) {
        return a * b / gcd;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Tester
{

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static long mod = 1000000007;
    public static void main(String[] args) {

    	solveQ2();

    }

	private static void solveQ3() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();

		long x = sc.nextLong();
		long k = sc.nextLong();

		if(x == 0) {
			System.out.println(0);
			return;
		}
		long ans = modExp(2, k);
		x = (2*x)%mod;
		x = (x - 1 + mod)%mod;
		ans = (ans*x)%mod;
		ans = (ans + 1)%mod;

		System.out.println(ans);

	}

	private static long modExp(long a, long n) {

		if(n == 0)
			return 1;
		if(n%2 == 0)
			return modExp((a*a)%mod, n/2);
		else
			return (a*modExp((a*a)%mod, n/2))%mod;

	}

	private static void solveQ2() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();
		long l = sc.nextLong();
		long r = sc.nextLong();

		long x = sc.nextLong();
		long y = sc.nextLong();

		if(y%x != 0) {
			System.out.println(0);
			return;
		}
		long n = y/x;

		long count = 0;
		int c=0;
		for(long i= 1; i<=Math.sqrt(n); i++) {

			if((n%i == 0) && (gcd(i,n/i)==1) && (i*x >= l) && ((n/i)*x <=r)) {

				//System.out.println(i*x + " " + (n/i)*x);
				if(i*i != n)
					count += 2;
				else
					count += 1;

			}

		}

		System.out.println(count);
	}

	public static long gcd(long a, long b) {

		if(b==0)
			return a;
		else
			return gcd(b, a%b);

	}

	private static void solveQ1() {
		// TODO Auto-generated method stub

		FastReader sc = new FastReader();
		int n = sc.nextInt();

		HashSet<Integer> hs = new HashSet<Integer>();
		for(int i=0; i<n; i++) {
			int x = sc.nextInt();
			if(x != 0) {
				hs.add(x);
			}
		}

		System.out.println(hs.size());

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        long l = scanner.nextLong();
        long r = scanner.nextLong();
        long x = scanner.nextLong();
        long y = scanner.nextLong();
        if (y%x!=0) {
            System.out.println("0");
            return;
        }
        long lim = y/x;
        long answer =0;
        for (long A=l/x; (A*A<=lim) && (A*x <=r);++A) {
            if (A==0) continue;
            if (lim%A==0) {
                long B = lim/A;
                if(B==0) continue;
                long gcd = gcd(A,B);
                if (gcd==1 && (A*x>=l) && (B*x>=l) &&(B*x<=r)) {
                    if (A!=B) {
                        answer+=2;
                    } else {
                        answer++;
                    }
                }
            }
        }
        System.out.println(answer);
    }

    public static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static long lcm(long a, long b, long gcd) {
        return a * (b / gcd);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.*;
import java.util.*;

public	 class template
	{
		private InputStream is;
		private PrintWriter pw;
		static char[][] ch;
		static int  x1,x2,y1,y2,n,m,h,k;
		static long dist[][];
		static boolean boo[][];

		void soln()
		{
			is = System.in;
			pw = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			pw.close();
			pw.flush();
			// tr(System.currentTimeMillis() - s + "ms");
		}

		public static void main(String[] args) throws Exception
		{
			new Thread(null, new Runnable()
			{
				public void run()
				{
					try
					{
						// new CODEFORCES().soln();
					} catch (Exception e)
					{
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();
			new template().soln();
		}

		void solve()
		{
			long l = ni(), r = ni(), x = ni(), y = ni();
			long mul = x*y;
			int cnt = 0;
			if(x==y && x>=l && x<=r) {pw.println(1);return;}
			long temp = Math.max(l,mul/r);
			temp += (((temp%x)==0)?0:x-(temp%x));
			for(long i = temp; i*i<=mul && i<= Math.min(r,mul/l);i+=x){
				//pw.println(i);
				if(mul%i==0 && gcd(i,mul/i)==x){
					//pw.println(i);
					if(mul/i != i) cnt+=2;
					else cnt++;
				}
			}
			pw.println(cnt);
			pw.close();
		}
		long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}
		void printArray(long[] arr) {
			for(long i : arr) pw.print(i +" ");
			pw.println();
		}
	static long min(long x, long y){
		return (x<y)?x:y;
	}
	static class Pair implements Comparable<Pair>{
		long val;
		int  x, y;
		Pair(long v, int a, int b){
			val = v; x = a; y = b;
		}
		public int compareTo(Pair p){
			return Long.compare(this.val,p.val);
		}
	}
	private static class Queue{
		int st = 0;
		int et = 0;
		Pair[] arr;
		public Queue(int len) {
			arr = new Pair[len];
		}
		public boolean isEmpty() {
			return st==et;
		}
		public void add(Pair x) {
			arr[et++] = x;
		}
		public Pair poll() {
			return arr[st++];
		}
		public void clear() {
			st = et = 0;
		}
	}
		/*void bfs(int k) {
			while(!q.isEmpty()) {
				int y = q.poll();
				for(long i : amp[y]) {
					if(!b[i]) {
						D[i][k] = D[y][k]+1;
						q.add(i);
						b[i] = true;
					}
				}
			}
		}
		*/
		/*
		int dfs(int x) {
			b[x] = true;
			//start[x] = time++;
			int ans = 1;
			for(int i : amp[x]) {
				if(!b[i]) {
					ans += dfs(i);
				}
			}
			//end[x] = time;
			if(x!= 0 && ans%2==0 && (N-ans)%2==0) cost++;

			return ans;
		}*/

		/*void buildGraph(int n)
		{
			for (int i = 0; i < n; i++)
			{
				int x1 = ni() - 1, y1 = ni() - 1;
				amp[x1].add(y1);
				amp[y1].add(x1);
			}
		}*/
		public static int[] shuffle(int[] a, Random gen)
		{
			for (int i = 0, n = a.length; i < n; i++)
			{
				int ind = gen.nextInt(n - i) + i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
			return a;
		}
		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte()
		{
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf)
			{
				ptrbuf = 0;
				try
				{
					lenbuf = is.read(inbuf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c)
		{
			return !(c >= 33 && c <= 126);
		}

		private int skip()
		{
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd()
		{
			return Double.parseDouble(ns());
		}

		private char nc()
		{
			return (char) skip();
		}

		private String ns()
		{
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b)))
			{ // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n)
		{
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b)))
			{
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m)
		{
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n)
		{
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private int ni()
		{
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl()
		{
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o)
		{
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rishabhdeep Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int l = in.nextInt(), r = in.nextInt(), x = in.nextInt(), y = in.nextInt();
            if (y % x != 0) {
                out.println(0);
                return;
            }
            l = (l + x - 1) / x;
            r = r / x;
            y /= x;
            int ans = 0;
            for (int i = 1; i * i <= y; i++) {
                if (y % i == 0) {
                    if (Utilities.gcd(i, y / i) == 1 && l <= i && y / i <= r) {
                        if (i == y / i) {
                            ans++;
                        } else {
                            ans += 2;
                        }
                    }
                }
            }
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class Utilities {
        public static long gcd(long a, long b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

    }
}

import java.io.*;
import java.util.Arrays;
import java.util.StringJoiner;
import java.util.StringTokenizer;

public class Main {

    static int L, R, X, Y;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        L = sc.nextInt();
        R = sc.nextInt();
        X = sc.nextInt();
        Y = sc.nextInt();

        System.out.println(solve());
    }

    static int solve() {
        if( Y % X != 0 ) return 0;

        // u = a / gcd
        // v = b / gcd
        // lcm = u * v * gcd
        int uv = Y / X;

        int ans = 0;
        for (int u = 1; u <= (int)Math.sqrt(uv); u++) {
            if( uv % u != 0 ) continue;

            int v = uv / u;
            long a = (long)X * u;
            long b = (long)X * v;

            if( gcd(a, b) == X && L <= a && a <= R && L <= b && b <= R ) {
                if( a != b ) {
                    ans += 2;
                } else {
                    ans += 1;
                }
            }
        }
        return ans;
    }

    static long gcd(long a, long b) {
        while (b > 0) {
            long c = a;
            a = b;
            b = c % b;
        }
        return a;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        int[] nextIntArray(int n, int delta) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt() + delta;
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }
    }

    static void writeLines(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int a : as) pw.println(a);
        pw.flush();
    }

    static void writeLines(long[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (long a : as) pw.println(a);
        pw.flush();
    }

    static void writeSingleLine(int[] as) {
        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 0; i < as.length; i++) {
            if (i != 0) pw.print(" ");
            pw.print(i);
        }
        pw.println();
        pw.flush();
    }

    static int max(int... as) {
        int max = Integer.MIN_VALUE;
        for (int a : as) max = Math.max(a, max);
        return max;
    }

    static int min(int... as) {
        int min = Integer.MAX_VALUE;
        for (int a : as) min = Math.min(a, min);
        return min;
    }

    static void debug(Object... args) {
        StringJoiner j = new StringJoiner(" ");
        for (Object arg : args) {
            if (arg instanceof int[]) j.add(Arrays.toString((int[]) arg));
            else if (arg instanceof long[]) j.add(Arrays.toString((long[]) arg));
            else if (arg instanceof double[]) j.add(Arrays.toString((double[]) arg));
            else if (arg instanceof Object[]) j.add(Arrays.toString((Object[]) arg));
            else j.add(arg == null ? "null" : arg.toString());
        }
        System.err.println(j.toString());
    }

    static void printSingleLine(int[] array) {
        for (int i = 0; i < array.length; i++) {
            if (i != 0) System.out.print(" ");
            System.out.print(array[i]);
        }
        System.out.println();
    }

    static int lowerBound(int[] array, int value) {
        int low = 0, high = array.length, mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;
            if (array[mid] < value) low = mid + 1;
            else high = mid;
        }
        return low;
    }

    static int upperBound(int[] array, int value) {
        int low = 0, high = array.length, mid;
        while (low < high) {
            mid = ((high - low) >>> 1) + low;
            if (array[mid] <= value) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

import java.io.*;
import java.util.*;

public class B {
	static long mod = 1000000007;

	public static void main(String[] args) throws Exception
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long l = sc.readLong(), r = sc.readLong(), x = sc.readLong(), y = sc.readLong(), i;
		long mult = x * y, pair = 0;
		for(i = x ; i * i <= mult ; i += x)
		{
			if(mult % i == 0)
			{
				long num1 = mult/i, num2 = i, g = gcd(num1, num2);
				if(g == x && mult/g == y && l <= num1 && num1 <= r && l <= num2 && num2 <= r)
				{
					pair++;
					if(num1 != num2)	pair++;
				}
			}
		}
		out.println(pair);

		out.close();
	}

	public static long gcd(long x, long y)
	{
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long pow(long n, long p, long m)
	{
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0)
		{
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b)
		{
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o)
		{
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
			// return 0;
		}

		public boolean equals(Object o)
		{
			if (o instanceof Pair)
			{
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode()
		{
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}
	}

	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int readInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next() {
			return readString();
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}

//package jan2020;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class A992 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		long l = scn.nextLong();
		long r = scn.nextLong();
		long hcf = scn.nextLong();
		long lcm = scn.nextLong();

		ArrayList<Long> factors = new ArrayList<>();
		for (long i = 1; i * i <= lcm; i++) {
			if (lcm % i == 0) {
				factors.add(i);
				if (i != (lcm / i)) {
					factors.add(lcm / i);
				}
			}
		}
				double pairs = 0;
				for (int i = 0; i < factors.size(); i++) {
					long curr = factors.get(i);
					for (int j = 0; j < factors.size(); j++) {
						{
							long val3 = factors.get(j);
							long gcd1 = gcd(curr, factors.get(j));
							long lcm1 = (curr * factors.get(j)) / gcd1;
							// System.out.println(gcd1+","+lcm1);
							if (gcd1 == hcf && lcm1 == lcm) {

								if (curr >= l && curr <= r) {
									if (val3 >= l && val3 <= r) {
										pairs++;

									}
								}
							}
						}

					}

				}
				out.println((long)pairs);

		out.close();

	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.readInt();
            long r = in.readInt();
            long x = in.readInt();
            long y = in.readInt() * x;
            int ans = 0;
            long i = Math.max(y / r, l);
            if (i % x != 0) {
                i += (x - (i % x));
            }
            for (; i <= r; i += x) {
                long j = y / i;
                if (j < i) break;
                if (i * j != y) continue;
                if (j < l || j > r) continue;
                if (MathUtil.gcd(i, j) != x) continue;
                ans++;
                if (j != i) ans++;
            }
            out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class MathUtil {
        public static long gcd(long a, long b) {
            while (b > 0) {
                long t = a % b;
                a = b;
                b = t;
            }
            return a;
        }

    }
}

import java.util.*;
public class NastyaStudiesInformatics {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		long mult = x * y;
		long count = 0;
		long i;
		long s = (long)Math.sqrt(mult);
		for(i=x;i<=s;i+=x)
		{
			if((mult%i)==0)
			{
				long p = (mult/i);
				if(p>=l && p<=r && i>=l && i<=r)
				{
					long g = gcd(i,p);
					if(g==x)
					{
					    if(i==p)
					        count++;
					    else
					        count += 2;
					}
				}
			}
		}

		System.out.println(count);
	}

	public static long gcd(long A,long B)
	{
		if(B==0)	return A;

		return gcd(B,A%B);
	}

}

/**
 * Date: 18 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Set;

public class newProgram1 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int l = in.ni();
        int r = in.ni();
        long x = in.ni();
        long y = in.ni();
        Set<Long> ss = new HashSet<>();
        for (long i = 1; i * i <= y; i++) {
            if (y % i == 0) {
//                System.out.println(i);
                ss.add(i);
                ss.add(y / i);
            }
        }
        GCD gcd = new GCD();
        int count = 0;
        y = y * x;
        for (long i : ss) {
            if (gcd.calc_gcd(i, y / i) == x) {
//                System.out.println(i + " " + gcd.calc_gcd(i, y / i));
                if (l <= i && i <= r && l <= y / i && y / i <= r) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class GCD {

    public GCD() {
        // Sry Nothing to initalise
    }

    public long a_inv_b(long a, long m) {
        if (gcd(a, m) == 1) {
            long m0 = m;
            long y = 0, x = 1;
            if (m == 1) {
                return 0;
            }
            while (a > 1) {
                long q = a / m;
                long t = m;
                m = a % m;
                a = t;
                t = y;
                y = x - q * y;
                x = t;
            }
            if (x < 0) {
                x += m0;
            }
            return x;
        } else {
            return -1;
        }
    }

    public int calc_gcd(int a, int b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return (int) gcd(a, b);
    }

    public long calc_gcd(long a, long b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return gcd(a, b);
    }

    private long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        long gcd = gcd(b, a % b);
        return gcd;
    }
}

import java.io.*;
import java.util.*;
import javafx.util.*;

public class cf489B{
	static long gcd(long x, long y){
       if(x%y==0){
         return y;
       }

       return gcd(y,x%y);
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();
        long ans = 0;
        HashSet<Pair<Long,Long>> hs = new HashSet<Pair<Long,Long>>();
		if(y%x!=0){
          System.out.println("0");
		}
		else{
			long d = x*y;
			for(long i=x;i<(long)(Math.sqrt(d)+1);i+=x){
               if(d%i==0){
                 long dd = d/i;
                 if(dd>=l && dd<=r && i>=l && i<=r && gcd(dd,i)==x){
                    hs.add(new Pair<Long,Long>(dd,i));
                    hs.add(new Pair<Long,Long>(i,dd));
                 }
               }
			}
			System.out.println(hs.size());
		}

	}
}

// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF992B extends PrintWriter {
	CF992B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF992B o = new CF992B(); o.main(); o.flush();
	}

	int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	void main() {
		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();
		int m = sc.nextInt();
		if (m % d != 0) {
			println(0);
			return;
		}
		int x = m / d;
		int ans = 0;
		for (int p = 1; p <= x / p; p++)
			if (x % p == 0) {
				int q = x / p;
				if (gcd(p, q) == 1) {
					int a = p * d;
					int b = q * d;
					if (l <= a && b <= r) {
						ans++;
						if (a != b)
							ans++;
					}
				}
			}
		println(ans);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Fast {

	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}

	static class Reader {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}

	public static boolean isPrime(int n) {
		if(n == 1)
		{
			return false;
		}
		for(int i = 2;i*i<=n;i++)
		{
			if(n%i == 0)
			{
				return false;
			}
		}
		return true;
	}

	public static int gcd(int a, int b)
	{
		if(b == 0)
		 return a;

		else
		return gcd(b,a%b);
	}

	public static long LongGCD(long a, long b)
	{
		if(b == 0)
			 return a;

			else
			return LongGCD(b,a%b);
	}

	public static int lcm(int a, int b)
    {
        return (a / gcd(a, b)) * b;
    }

	public static long LongLCM(long a, long b)
	{
		return (a / LongGCD(a,b)) * b;
	}

	public static int phi(int n)  //euler totient function
    {
        int result = 1;
        for (int i = 2; i < n; i++)
            if (gcd(i, n) == 1)
                result++;
        return result;
    }

	public static int[] computePrefix(int arr[], int n)
	{
		int[] prefix = new int[n];
		prefix[0] = arr[0];
		for(int i = 1;i<n;i++)
		{
			prefix[i] = prefix[i-1]+arr[i];
		}

		return prefix;
	}

	public static int fastPow(int x, int n) //include mod at each step if asked and in args of fn too
	{
		if(n == 0)
			return 1;
		else if(n%2 == 0)
			return fastPow(x*x,n/2);
		else
			return x*fastPow(x*x,(n-1)/2);
	}

	static int LowerBound(int a[], int x) {
		  int l=-1,r=a.length;
		  while(l+1<r) {
		    int m=(l+r)>>>1;
		    if(a[m]>=x) r=m;
		    else l=m;
		  }
		  return r;
		}

	static int UpperBound(int a[], int x) {
	    int l=-1,r=a.length;
	    while(l+1<r) {
	       int m=(l+r)>>>1;
	       if(a[m]<=x) l=m;
	       else r=m;
	    }
	    return l+1;
	 }

	   static int power(int x, int y, int p)
	    {

	        int res = 1;

	        x = x % p;

	        while (y > 0) {
	            if (y % 2 == 1)
	                res = (res * x) % p;

	            y = y >> 1;
	            x = (x * x) % p;
	        }

	        return res;
	    }

	    static int modInverse(int n, int p)
	    {
	        return power(n, p - 2, p);
	    }

	    //Fermat's little theorem for nCr % p.
	    static int nCrModPFermat(int n, int r,
	                             int p)
	    {

	          if (n<r)
	              return 0;
	        if (r == 0)
	            return 1;
	        int[] fac = new int[n + 1];
	        fac[0] = 1;

	        for (int i = 1; i <= n; i++)
	            fac[i] = fac[i - 1] * i % p;

	        return (fac[n] * modInverse(fac[r], p)
	                % p * modInverse(fac[n - r], p)
	                % p)
	            % p;
	    }

		public static void Sort(int[] a) {
			ArrayList<Integer> l=new ArrayList<>();
			for (int i:a) l.add(i);
			Collections.sort(l);
			//Collections.reverse(l);  //Use to Sort decreasingly
			for (int i=0; i<a.length; i++) a[i]=l.get(i);
		}

	public static void main(String[] args) {
		Reader sc=new Reader();

		int l = sc.nextInt(), r = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt();

		if(y%x!=0)
		{
			System.out.println(0);
			return;
		}
		int ans = 0;
		int n = y/x;
		for(int i = 1;i*i<=n;i++)
		{
			if(n%i == 0)
			{
				int c = n/i;
				if(l <= c * x && c * x <= r && l<=i*x && i*x <= r && gcd(c,i) == 1) {
					if(i*i == n)	++ans;
					else ans+=2;
				}
			}
		}

		System.out.println(ans);
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	static ArrayList<Integer> adj[];
	static PrintWriter out = new PrintWriter(System.out);
	public static long mod;

	static int [][]notmemo;
	static int k;
	static int a[];
	static int b[];
	static int m;
	static char c[];

	static int trace[];
	static int h[];
	static int x;
	static int ans1;
	static int ans2;
    static char t[];
	static char l[];
	static char r[];
    static int w;
    static int s;
	static int fn[];
    public static void main(String args[]) throws IOException {
		Scanner sc = new Scanner(System.in);
		 int l=sc.nextInt();
		 int r=sc.nextInt();
		 int x=sc.nextInt();

		 int y=sc.nextInt();
	int count=0;
	if(y%x!=0) {
		System.out.println(0);
		return;
	}
	int n=y/x;
		 for (int i = 1; i <=Math.sqrt(n); i++) {
		if(n%i==0) {

			if(gcd(i,n/i)!=1||i*x<l||i*x>r||(n/i)*x>r||(n/i)*x<l) {
			continue;
		}
		if(i==(n/i))
		count+=1;
		else
			count+=2;
		}
	  }
		 System.out.println(count);
		out.flush();
    }
    static int max=(int) (1e5+1);
        static void sieve(int N)	// O(N log log N)
	{
		isComposite = new int[N+1];
		isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if(1l * i * i <= N)
					for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
						isComposite[j] = 1;
			}
	}
    static TreeSet<Integer> factors;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
	{
		ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while(1l*p * p <= N)
		{
			while(N % p == 0) { factors.add(p); N /= p; }
			p = primes.get(++idx);
		}

		if(N != 1)						// last prime factor may be > sqrt(N)
			factors.add(N);				// for integers whose largest prime factor has a power of 1
		return factors;
	}
    static int dp(int i,int rem) {
	if(rem==0||i==0) {
		return 0;
	}
	if(notmemo[i][rem]!=-1) {
		return notmemo[i][rem];
	}

	int ans=0;
	for (int j = 1; j <=Math.min(rem,k); j++) {
		ans=Math.max(ans, dp(i-1,rem-j)+h[j]);
	}

	return notmemo[i][rem]=ans;
    }
    static String y;
    	static int nomnom[];
	static long fac[];

	static class book implements Comparable<book> {
		int idx;
		long score;

		public book(int i, long s) {
			idx = i;
			score = s;
		}

		public int compareTo(book o) {
			return (int) (o.score - score);
		}
	}

	static class library implements Comparable<library> {
		int numofbooks;
		int signup;
		int shiprate;
		int idx;

		public library(int a, int b, int c, int idx) {
			numofbooks = a;
			signup = b;
			shiprate = c;
			this.idx = idx;
		}

		@Override
		public int compareTo(library o) {
		if(signup==o.signup) {
			  return o.numofbooks-numofbooks;
		}
		return signup - o.signup;

		}
	}

	static boolean isOn(int S, int j) {
		return (S & 1 << j) != 0;
	}

	static boolean f = true;

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree, lazy;

		SegmentTree(int[] in) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new int[N << 1];
			//build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}
		}

		void update_point(int index, int val) // O(log n)
		{
			index += N - 1;
			sTree[index] = val;
			while(index>1)
			{
				index >>= 1;
				sTree[index] = Math.max(sTree[index<<1] ,sTree[index<<1|1]);
			}
		}

		void update_range(int i, int j, int val) // O(log n)
		{
			update_range(1, 1, N, i, j, val);
		}

		void update_range(int node, int b, int e, int i, int j, int val) {
			if (i > e || j < b)
				return;
			if (b >= i && e <= j) {
				sTree[node] += (e - b + 1) * val;
				lazy[node] += val;
			} else {
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node << 1, b, mid, i, j, val);
				update_range(node << 1 | 1, mid + 1, e, i, j, val);
				sTree[node] = sTree[node << 1] + sTree[node << 1 | 1];
			}

		}

		void propagate(int node, int b, int mid, int e) {
			lazy[node << 1] += lazy[node];
			lazy[node << 1 | 1] += lazy[node];
			sTree[node << 1] += (mid - b + 1) * lazy[node];
			sTree[node << 1 | 1] += (e - mid) * lazy[node];
			lazy[node] = 0;
		}

		int query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		int query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return 0;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			// propagate(node, b, mid, e);
			int q1 = query(node << 1, b, mid, i, j);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return Math.max(q1,q2);

		}
	}

	static int memo[];

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;
		int max[];

		public UnionFind(int N) {
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];

			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;

			}
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	/**
	 * private static void trace(int i, int time) { if(i==n) return;
	 *
	 *
	 * long ans=dp(i,time);
	 * if(time+a[i].t<a[i].burn&&(ans==dp(i+1,time+a[i].t)+a[i].cost)) {
	 *
	 * trace(i+1, time+a[i].t);
	 *
	 * l1.add(a[i].idx); return; } trace(i+1,time);
	 *
	 * }
	 **/

	static class incpair implements Comparable<incpair> {
		int a;
		long b;
		int idx;

		incpair(int a, long dirg, int i) {
			this.a = a;
			b = dirg;
			idx = i;
		}

		public int compareTo(incpair e) {
			return (int) (b - e.b);
		}
	}

	static class decpair implements Comparable<decpair> {
		int a;
		long b;
		int idx;

		decpair(int a, long dirg, int i) {
			this.a = a;
			b = dirg;
			idx = i;
		}

		public int compareTo(decpair e) {
			return (int) (e.b - b);
		}
	}

	static long allpowers[];

	static class Quad implements Comparable<Quad> {
		int u;
		int v;
		char state;
		int turns;

		public Quad(int i, int j, char c, int k) {
			u = i;
			v = j;
			state = c;
			turns = k;
		}

		public int compareTo(Quad e) {
			return (int) (turns - e.turns);
		}

	}

	static long dirg[][];
	static Edge[] driver;

	static int n;

	static class Edge implements Comparable<Edge> {
		int node;
		long cost;

		Edge(int a, long dirg) {
			node = a;
			cost = dirg;
		}

		public int compareTo(Edge e) {
			return (int) (cost - e.cost);
		}
	}

	static long manhatandistance(long x, long x2, long y, long y2) {
		return Math.abs(x - x2) + Math.abs(y - y2);
	}

	static long fib[];

	static long fib(int n) {
		if (n == 1 || n == 0) {
			return 1;
		}
		if (fib[n] != -1) {
			return fib[n];
		} else
			return fib[n] = ((fib(n - 2) % mod + fib(n - 1) % mod) % mod);
	}

	static class Point  implements Comparable<Point>{
		long x, y;

		Point(long counth, long counts) {
			x = counth;
			y = counts;
		}

		@Override
		public int compareTo(Point p )
		{
			return Long.compare(p.y*1l*x, p.x*1l*y);
		}

	}

	static long[][] comb;

	static class Triple implements Comparable<Triple> {

		int l;
		int r;
		long cost;
		int idx;

		public Triple(int a, int b, long l1, int l2) {
			l = a;
			r = b;
			cost = l1;
			idx = l2;
		}

		public int compareTo(Triple x) {
			if (l != x.l || idx == x.idx)
				return l - x.l;
			return -idx;
		}

	}

	static TreeSet<Long> primeFactors(long N) // O(sqrt(N) / ln sqrt(N))
	{
		TreeSet<Long> factors = new TreeSet<Long>(); // take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * p <= N) {
			while (N % p == 0) {
				factors.add((long) p);
				N /= p;
			}
			if (primes.size() > idx + 1)
				p = primes.get(++idx);
			else
				break;
		}

		if (N != 1) // last prime factor may be > sqrt(N)
			factors.add(N); // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static boolean visited[];

	/**
	 * static int bfs(int s) { Queue<Integer> q = new LinkedList<Integer>();
	 * q.add(s); int count=0; int maxcost=0; int dist[]=new int[n]; dist[s]=0;
	 * while(!q.isEmpty()) {
	 *
	 * int u = q.remove(); if(dist[u]==k) { break; } for(Pair v: adj[u]) {
	 * maxcost=Math.max(maxcost, v.cost);
	 *
	 *
	 *
	 * if(!visited[v.v]) {
	 *
	 * visited[v.v]=true; q.add(v.v); dist[v.v]=dist[u]+1; maxcost=Math.max(maxcost,
	 * v.cost); } }
	 *
	 * } return maxcost; }
	 **/
	public static boolean FindAllElements(int n, int k) {
		int sum = k;
		int[] A = new int[k];
		Arrays.fill(A, 0, k, 1);

		for (int i = k - 1; i >= 0; --i) {

			while (sum + A[i] <= n) {

				sum += A[i];
				A[i] *= 2;
			}
		}
		if (sum == n) {
			return true;
		} else
			return false;
	}

	static boolean vis2[][];

	static boolean f2 = false;

	static long[][] matMul(long[][] a2, long[][] b, int p, int q, int r) // C(p x r) = A(p x q) x (q x r) -- O(p x q x
																			// r)
	{
		long[][] C = new long[p][r];
		for (int i = 0; i < p; ++i) {
			for (int j = 0; j < r; ++j) {
				for (int k = 0; k < q; ++k) {
					C[i][j] = (C[i][j] + (a2[i][k] % mod * b[k][j] % mod)) % mod;
					C[i][j] %= mod;
				}

			}
		}
		return C;
	}

	static int memo1[];

	static boolean vis[];
	static TreeSet<Integer> set = new TreeSet<Integer>();

	static long modPow(long ways, long count, long mod) // O(log e)
	{
		ways %= mod;
		long res = 1;
		while (count > 0) {
			if ((count & 1) == 1)
				res = (res * ways) % mod;
			ways = (ways * ways) % mod;
			count >>= 1;
		}
		return res % mod;
	}

	static long gcd(long ans, long b) {
		if (b == 0) {
			return ans;
		}
		return gcd(b, ans % b);
	}

	static int[] isComposite;
	static int[] valid;

	static ArrayList<Integer> primes;
	static ArrayList<Integer> l1;

	static TreeSet<Integer> primus = new TreeSet<Integer>();

	static void sieveLinear(int N)
	{
		int[] lp = new int[N + 1];								//lp[i] = least prime divisor of i
		for(int i = 2; i <= N; ++i)
		{
			if(lp[i] == 0)
			{
				primus.add(i);
				lp[i] = i;
			}
			int curLP = lp[i];
			for(int p: primus)
				if(p > curLP || p * i > N)
					break;
				else
					lp[p * i] = i;
		}
	}

	public static int[] schuffle(int[] p) {
		for (int i = 0; i < p.length; i++) {
			int x = (int) (Math.random() * p.length);
			int temp = p[x];
			p[x] = p[i];
			p[i] = temp;
		}
		return p;
	}

	static int V;
	static long INF = (long) 1E16;

	static class Edge2 {
		int node;
		long cost;
		long next;

		Edge2(int a, int c, Long long1) {
			node = a;
			cost = long1;
			next = c;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}

		public int[] nxtArr(int n) throws IOException {
			int[] ans = new int[n];
			for (int i = 0; i < n; i++)
				ans[i] = nextInt();
			return ans;
		}
	}
}

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class TaskB {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long l = sc.nextInt();
		long r = sc.nextInt();
		long x = sc.nextInt();
		long y = sc.nextInt();

		int count = 0;

		for (long i = x; i * i <= x * y; i += x) {
			if ((x * y) % i == 0 && ((x * y) / i) >= l && ((x * y) / i) <= r && i <= r && i >= l) {
				if (gcd(i, (x * y) / i) == x) {
					if (i != (x * y) / i) {
						count = count + 2;
					} else {
						count++;
					}
				}
			}
		}

		System.out.println(count);
	}

	public static long gcd(long a, long b) {
		if(b == 0) {
			return a;
		}else {
			return gcd(b, a%b);
		}
	}

}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

    public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static int gcd(int a, int b){
        while (a>0 && b>0){
            if (a>b) a%=b; else b%=a;
        }
        return a+b;
    }

    public static void main(String[] args) throws IOException {
        int l=read();
        int r=read();
        int x=read();
        int y=read();

        if (y%x!=0){
            System.out.println(0);
            System.exit(0);
        }
        int cnt=0;
        int n=y/x;
        for (int i=1; i*i<=n; i++){
            if (n%i==0){
                int z=n/i;
                if (l<=z*x && z*x<=r && l<=x*i && x*i<=r && gcd(i,z)==1){
                    if (i*i==n) cnt++; else cnt+=2;
                }
            }
        }
        System.out.println(cnt);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
public class cf489b
{
	public static int M = 1000000007;
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] s = br.readLine().split(" ");
        int l = Integer.parseInt(s[0]);
        int r = Integer.parseInt(s[1]);
        long x = Long.parseLong(s[2]);
        long y = Long.parseLong(s[3]);
        int c=0;
        if(y%x!=0)
            out.println(0);
        else
            out.println(Solution(y/x,l,r,x));
        out.flush();
    }
    /** Loops
    *	i: for(int i=0;i<n;i++)
    *	j: for(int j=0;j<n;j++)
    *	k: for(int k=0;k<n;k++)

    *	ArrayList<Integer> arr1 = new ArrayList<>();

    * 	HashMap
    *	HashMap<Integer, Integer> hm = new HashMap<>();
    * 	for (Map.Entry<String,String> entry : hm.entrySet())
    		out.println(entry.getValue());

    *	Count frequencies
    	for(int i=0;i<n;i++)
        {
            Integer c = hm.get(Integer.parseInt(s[i]));
            if(c==null)
                hm.put(Integer.parseInt(s[i]),1);
            else
                hm.put(Integer.parseInt(s[i]),++c);
        }
	**/
    public static long modularExpo(long x,long n,int M)
	{
		long result=1;
		while(n>0)
		{
		    if(n%2==1)
		        result=(result*x)%M;
		    x=(x*x)%M;
		    n=n/2;
		}
		return result;
	}
	//FLT, only when a and M are co-prime
	public static long modInverse(int a,int M)
	{
		long g = gcd(a,M);
		if(g!=1)
			return -1;
	    return modularExpo(a,M-2,M);
	}
	public static long gcd(long a, long b)
	{
	    if(b==0)
	        return a;
	    else
	        return gcd(b, a % b);
	}
    public static int Solution(long n, long l, long r,long x)
    {
        int c=0;
        for (int i=1; i<=(int)Math.sqrt(n); i++)
        {
            if (n%i == 0)
            {
                if(i*x>=l && i*x<=r && (n/i)*x>=l && (n/i)*x<=r && gcd(i,n/i)==1)
                {
                    if(i!=n/i)c+=2;
                    else c++;
                }
            }
        }
        return c;
    }
}

import java.util.*;

public class B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		long m = x*y;
		long count =0;
		for(long i=x;i*i<=x*y;i = i+x){
			if(m%i==0&&(m/i)>=l&&(m/i)<=r&&i<=r&&i>=l){
				if(GCD(i,m/i)==x){
					if(i!=m/i){
						count=count+2;
					}
					else{
						count++;
					}
				}
			}
		}
		System.out.println(count);

	}
	public static long GCD(long a, long b) {
		   	if (b==0){
		   		return a;
		   	}

		   	return GCD(b,a%b);
		}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;

public class firstone {

    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        NumberFormat formatter = new DecimalFormat("#0.000000000000");

        long l = in.nextLong();
        long r = in.nextLong();
        long G = in.nextLong();
        long L = in.nextLong();
        if(L%G!=0)
        {
            out.print("0");
            out.close();
            return;
        }
        long mul = L*G;
        long sqrt = (long) (Math.sqrt(mul) + 1);
        long ans = 0;
        HashSet<Pair<Long,Long>> hs = new HashSet<>();
        for (long i = G;i<sqrt ; i+=G)
        {
            if(mul % i == 0)
            {
                L = mul / i;
                if(i>=l && i<=r && L>=l & L<=r && gcd(i,L) == G)
                {
                    hs.add(new Pair<Long, Long>(i,L));
                    hs.add(new Pair<Long, Long>(L,i));
                }
            }
        }
        out.println(hs.size());

        out.close();

    }
    public static long gcd(long a, long b) {
        while (b > 0) {
            long c = a;
            a = b;
            b = c % b;
        }
        return a;
    }

    static public final class Pair<A, B> {
        private final A a;
        private final B b;

        private Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        /**
         * Returns a pair whose elements are the first and second
         * arguments, respectively.
         * @return a pair constructed from the arguments
         */
        public static <C, D> Pair<C, D> valueOf(C c, D d) {
            // Don't mandate new values.
            return new Pair<C, D>(c, d);
        }

        /**
         * Returns the value of the first element of the pair.
         * @return the value of the first element of the pair
         */
        public A getA() {
            return a;
        }

        /**
         * Returns the value of the second element of the pair.
         * @return the value of the second element of the pair
         */
        public B getB() {
            return b;
        }

        /**
         * TBD
         */
        @Override
        public String toString() {
            return "[" + Objects.toString(a) + ", " + Objects.toString(b) + "]";
        }

        /**
         * TBD
         */
        @Override
        public boolean equals(Object x) {
            if (!(x instanceof Pair))
                return false;
            else {
                Pair<?,?> that = (Pair<?,?>) x;
                return
                        Objects.equals(this.a, that.a) &&
                                Objects.equals(this.b, that.b);
            }
        }

        /**
         * TBD
         */
        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;

public class firstone {

    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        NumberFormat formatter = new DecimalFormat("#0.000000000000");

        long l = in.nextLong();
        long r = in.nextLong();
        long G = in.nextLong();
        long L = in.nextLong();
        l = (l-1)/G;
        r = r/G;
        l++;
        if(l>L)
        {
            out.print("0");
            out.close();
            return;
        }
        if(L%G!=0)
        {
            out.print("0");
            out.close();
            return;
        }
        long div = L/G;
        int count = 0;
        for (int i = 1 ;i*i<=div;i++)
        {
            if(div % i ==0)
            {
                int a = i;
                int b = (int) (div/i);
                if(l<=a && b<=r)
                {
                    if(gcd(a,b) == 1)
                    {
                        if(a==b)
                        {
                            count++;
                        }else
                        {
                            count+=2;
                        }

                    }

                }

            }
        }
        out.print(count);

        out.close();

    }
    public static int gcd(int a, int b) {
        while (b > 0) {
            int c = a;
            a = b;
            b = c % b;
        }
        return a;
    }

    static public final class Pair<A, B> {
        private final A a;
        private final B b;

        private Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        /**
         * Returns a pair whose elements are the first and second
         * arguments, respectively.
         * @return a pair constructed from the arguments
         */
        public static <C, D> Pair<C, D> valueOf(C c, D d) {
            // Don't mandate new values.
            return new Pair<C, D>(c, d);
        }

        /**
         * Returns the value of the first element of the pair.
         * @return the value of the first element of the pair
         */
        public A getA() {
            return a;
        }

        /**
         * Returns the value of the second element of the pair.
         * @return the value of the second element of the pair
         */
        public B getB() {
            return b;
        }

        /**
         * TBD
         */
        @Override
        public String toString() {
            return "[" + Objects.toString(a) + ", " + Objects.toString(b) + "]";
        }

        /**
         * TBD
         */
        @Override
        public boolean equals(Object x) {
            if (!(x instanceof Pair))
                return false;
            else {
                Pair<?,?> that = (Pair<?,?>) x;
                return
                        Objects.equals(this.a, that.a) &&
                                Objects.equals(this.b, that.b);
            }
        }

        /**
         * TBD
         */
        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.util.*;
import java.io.*;
import java.math.*;
public class main {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0};
	void solve()
	{
		long l=ni();
		long r=ni();
		long x=ni();
		long y=ni();
		if(y%x!=0) {
			out.print(0);
			return;
		}
		long filter=y/x;
		long count=0;
		for(int i=1;i*i<=filter;i++)
		{
			if(filter%i==0) {
				if((filter/i)!=i) {
					long gcd=gcd(filter/i,i);
					if(gcd!=1)
						continue;
					if(i*x>=l&&i*x<=r&&(filter/i)*x>=l&&(filter/i)*x<=r)
						count+=2;
				}
				else if(i==1&&i*x>=l&&i*x<=r)
					count++;
			}
		}
		out.println(count);
	}
	int bsdown(ArrayList<Integer> al,int l) {
		int low=0,high=al.size()-1,ans=-1;
		while(low<=high) {
			int mid=low+(high-low)/2;
			if(al.get(mid)<=l) {
				low=mid+1;
				ans=mid;
			}else
				high=mid-1;
		}
		return ans;
	}
	ArrayList<Integer>al [];
	void take(int n,int m)
	{
		al=new ArrayList[n];
		for(int i=0;i<n;i++)
			al[i]=new ArrayList<Integer>();
		for(int i=0;i<m;i++)
		{
			int x=ni()-1;
			int y=ni()-1;
			al[x].add(y);
			al[y].add(x);

		}
	}
	int arr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)
		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	public static int count(long x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	      long x;
	      long y,k;
	      int i,h;
	      String s;
		Pair (long x,long y,int i){
			this.x=x;
			this.y=y;
			this.i=i;
		}

		public int compareTo(Pair o) {
			if(this.x!=o.x)
				return Long.compare(this.x,o.x);
			return Long.compare(this.y,o.y);
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}

	        @Override
	        public String toString() {
	            return  "("+x + " " + y +" "+k+" "+i+" )";
	        }

	    }

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(x%y==0)
			return y;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new main().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}

import java.util.*;
public class Main {
    public static long  gcd(long p, long q) {
        if (q == 0) {
            return p;
        }
        return gcd(q, p % q);
    }
	public static void main (String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt(), m =sc.nextInt();int k= sc.nextInt(), j = sc.nextInt();
	    int ans =0;
	    long mul = (long)k*j;
	    if(j%k!=0){
	        System.out.println(0); return;
	    }
	    //enter all pairs
	    for(int i=k;i*(long)i<=mul;i+=k){
	        if(mul%i==0){
	            if(mul/i>=n && mul/i<=m && i<=m && i>=n && gcd(mul/i,i)==k  ) {
	                ans+=2; if(i==mul/i) ans--;
	            }
	        }
	    }
	    System.out.println(ans);
	}
}

		/*input

		*/
		import java.io.ByteArrayInputStream;
		import java.io.IOException;
		import java.io.InputStream;
		import java.io.PrintWriter;
		import java.util.*;
		import java.io.*;
		public class Main {
		InputStream is;
			PrintWriter out;
			String INPUT = "";
		//class Declaration
		static class pair implements Comparable<pair>{
			int x,y;

			pair (int i,int j)
			{ x=i; y=j;

			}
			public int compareTo(pair p){
				if(this.x!=p.x) { return this.x-p.x;}
				else { return this.y-p.y;}
			}
			public int hashCode() { return (x+" "+y).hashCode();}
			public String toString(){ return x+" "+y;}
			public boolean equals(Object o){
				pair x = (pair) o ;
				return (x.x==this.x&&x.y==this.y);}
		}

	void solve() {
	long l=nl(),r=nl(),x=nl(),y=nl();
	long nl=l%x==0?l/x:l/x+1;
	long nr = r/x;
	if(y%x!=0) pn(0);
	else{
		long num=y/x;
		long cnt=0;
		for(int i=1;i*i<=num;++i){
			if(num%i==0){
				long f =num/i,s=i;
				if(f >= nl && f<=nr && s>=nl && s<=nr && gcd((int)f,(int)s)==1) {
					if(f==s) cnt++;
					else cnt+=2;
				}
			}
		}
		pn(cnt);
	}

	}

	int gcd(int a, int b)
	{
	if (b == 0)
		return a;
	return gcd(b, a % b);
	}

		void run() throws Exception
		{
				is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
				out = new PrintWriter(System.out);

				long s = System.currentTimeMillis();
				solve();
				out.flush();
				if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
		}

			public static void main(String[] args) throws Exception { new Main().run(); }

		//output methods
		private void pn(Object o)
		{
			out.println(o);
		}
		private void p(Object o)
		{
			out.print(o);
		}

		//input methods
				private byte[] inbuf = new byte[1024];
			public int lenbuf = 0, ptrbuf = 0;

			private int readByte()
			{
				if(lenbuf == -1)throw new InputMismatchException();
				if(ptrbuf >= lenbuf){
					ptrbuf = 0;
					try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
					if(lenbuf <= 0)return -1;
				}
				return inbuf[ptrbuf++];
			}

			private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
			private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

			private double nd() { return Double.parseDouble(ns()); }
			private char nc() { return (char)skip(); }

			private String ns()
			{
				int b = skip();
				StringBuilder sb = new StringBuilder();
				while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
					sb.appendCodePoint(b);
					b = readByte();
				}
				return sb.toString();
			}

			private char[] ns(int n)
			{
				char[] buf = new char[n];
				int b = skip(), p = 0;
				while(p < n && !(isSpaceChar(b))){
					buf[p++] = (char)b;
					b = readByte();
				}
				return n == p ? buf : Arrays.copyOf(buf, p);
			}

			private char[][] nm(int n, int m)
			{
				char[][] map = new char[n][];
				for(int i = 0;i < n;i++)map[i] = ns(m);
				return map;
			}

			private int[] na(int n)
			{
				int[] a = new int[n];
				for(int i = 0;i < n;i++)a[i] = ni();
				return a;
			}

			private int ni()
			{
				int num = 0, b;
				boolean minus = false;
				while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
				if(b == '-'){
					minus = true;
					b = readByte();
				}

				while(true){
					if(b >= '0' && b <= '9'){
						num = num * 10 + (b - '0');
					}else{
						return minus ? -num : num;
					}
					b = readByte();
				}
			}

			private long nl()
			{
				long num = 0;
				int b;
				boolean minus = false;
				while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
				if(b == '-'){
					minus = true;
					b = readByte();
				}

				while(true){
					if(b >= '0' && b <= '9'){
						num = num * 10 + (b - '0');
					}else{
						return minus ? -num : num;
					}
					b = readByte();
				}
			}

			private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
		}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code2
{
	public static ArrayList<Long> arr;
	public static int answer;
	public static long l;
	public static long r;
	public static long x;
	public static long y;
	public static long mul;
	public static void function(int idx,long cur)
	{
		if(idx==arr.size())
		{
			long one = x*cur;
			long two = (mul*x)/cur;
			//System.out.println(one + " " + two);
			if(one>=l && one<=r && two>=l && two<=r)
				answer++;
			return;
		}
		function(idx+1, cur);
		function(idx+1, cur*arr.get(idx));

	}
	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		l = in.nextLong();
		r = in.nextLong();
		x = in.nextLong();
		y = in.nextLong();

		if(x==y)
		{
			if(x>=l && x<=r)
				pw.println(1);
			else
				pw.println(0);
		}

		else if(y%x!=0)
			pw.print(0);
		else
		{
			arr = new ArrayList<>();
			answer = 0;
			mul = 1;
			y/=x;
			for(int i=2;(long)i*(long)i<=y;i++)
			{
				long temp = 1;
				while(y%i==0)
				{
					temp *=(long)i;
					y/=(long)i;
				}
				if(temp!=1)
					arr.add(temp);
			}
			if(y!=1)
				arr.add(y);
			for(long p : arr)
				mul *=p;
			function(0, 1);
			pw.println(answer);
		}
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int 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;
	}

	static class pair implements Comparable<pair>
	{
		Long x, y;
		pair(long x,long y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class NastyaStudiesInformatics {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int l = s.nextInt();
        int r = s.nextInt();
        int x = s.nextInt();
        int y = s.nextInt();
        int ct = 0;
        if (y % x != 0) {
            System.out.println(0);
            return;
        }
        Set<Integer> set = new HashSet<>();
        for (int i = 1; i < Math.sqrt(y); i++) {
            if (y % (i * x) == 0) {
                set.add(i);
                set.add(y / (i * x));
            }
        }
        for (int i : set) {
            int k = y / (i * x);
            int a = i * x;
            int b = k * x;
            if (Math.max(a, b) <= r && Math.min(a, b) >= l && gcd(i, k) == 1) ct++;
        }
        System.out.println(ct);
    }

    private static int gcd(int a, int b) {
        if (a == 0) return b;
        return gcd(b%a, a);
    }
}

//package baobab;
import java.io.*;
import java.util.*;

public class B {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            long ansCount = 0;

            long l = io.nextLong();
            long r = io.nextLong();
            long x = io.nextLong();
            long y = io.nextLong();

            long goal = x*y;

            long a=x;
            for (; a<=r ; a+=x) {
                if (a<l) continue;
                long b = goal/a;
                if (a > b) break;
                if (goal%a != 0) continue;
                if (b > r) continue;

                long bah = gcd(a, b);
                if (bah != x) continue; // gcd check
                if (a*b != y*bah) continue; // lcm check

                //System.out.println("What makes " + goal + "? " + a + " and " + b);
                if (a == b) {
                    ansCount++;
                } else {
                    ansCount += 2;
                }
            }

            io.println(ansCount);
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        boolean closeToZero(double v) {
            // Check if double is close to zero, considering precision issues.
            return Math.abs(v) <= 0.0000000000001;
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        /************************** Range queries **************************/

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        /***************************** Graphs *****************************/

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        /**************************** Geometry ****************************/

        class Point {
            int y;
            int x;

            public Point(int y, int x) {
                this.y = y;
                this.x = x;
            }
        }

        boolean segmentsIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
            // Returns true if segment 1-2 intersects segment 3-4

            if (x1 == x2 && x3 == x4) {
                // Both segments are vertical
                if (x1 != x3) return false;
                if (min(y1,y2) < min(y3,y4)) {
                    return max(y1,y2) >= min(y3,y4);
                } else {
                    return max(y3,y4) >= min(y1,y2);
                }
            }
            if (x1 == x2) {
                // Only segment 1-2 is vertical. Does segment 3-4 cross it? y = a*x + b
                double a34 = (y4-y3)/(x4-x3);
                double b34 = y3 - a34*x3;
                double y = a34 * x1 + b34;
                return y >= min(y1,y2) && y <= max(y1,y2) && x1 >= min(x3,x4) && x1 <= max(x3,x4);
            }
            if (x3 == x4) {
                // Only segment 3-4 is vertical. Does segment 1-2 cross it? y = a*x + b
                double a12 = (y2-y1)/(x2-x1);
                double b12 = y1 - a12*x1;
                double y = a12 * x3 + b12;
                return y >= min(y3,y4) && y <= max(y3,y4) && x3 >= min(x1,x2) && x3 <= max(x1,x2);
            }
            double a12 = (y2-y1)/(x2-x1);
            double b12 = y1 - a12*x1;
            double a34 = (y4-y3)/(x4-x3);
            double b34 = y3 - a34*x3;
            if (closeToZero(a12 - a34)) {
                // Parallel lines
                return closeToZero(b12 - b34);
            }
            // Non parallel non vertical lines intersect at x. Is x part of both segments?
            double x = -(b12-b34)/(a12-a34);
            return x >= min(x1,x2) && x <= max(x1,x2) && x >= min(x3,x4) && x <= max(x3,x4);
        }

        boolean pointInsideRectangle(Point p, List<Point> r) {
            Point a = r.get(0);
            Point b = r.get(1);
            Point c = r.get(2);
            Point d = r.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (closeToZero(sumOfAreas - areaOfRectangle(r))) {
                if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {
                    return false;
                }
                return true;
            }
            return false;
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfRectangle(List<Point> r) {
            double side1xDiff = r.get(0).x - r.get(1).x;
            double side1yDiff = r.get(0).y - r.get(1).y;
            double side2xDiff = r.get(1).x - r.get(2).x;
            double side2yDiff = r.get(1).y - r.get(2).y;
            double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);
            double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);
            return side1 * side2;
        }

        boolean pointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {
            double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
            return (closeToZero(areaTimes2));
        }

        class PointToLineSegmentDistanceCalculator {

            // Just call this
            double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {
                return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));
            }

            private double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {
                double l2 = dist2(x1,y1,x2,y2);
                if (l2 == 0) return dist2(point_x, point_y, x1, y1);
                double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;
                if (t < 0) return dist2(point_x, point_y, x1, y1);
                if (t > 1) return dist2(point_x, point_y, x2, y2);

                double com_x = x1 + t * (x2 - x1);
                double com_y = y1 + t * (y2 - y1);
                return dist2(point_x, point_y, com_x, com_y);
            }

            private double dist2(double x1, double y1, double x2, double y2) {
                return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);
            }

        }

        /****************************** Math ******************************/

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        /**************************** Strings ****************************/

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        /*************************** Technical ***************************/

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main{
    static long gcd(long a, long b){
	if(b==0){
	    return a;
	}else{
	    return gcd(b,a%b);
	}
    }

    public static void main(String[] args)throws IOException{
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
	String s[] = br.readLine().split(" ");
	long l = Long.parseLong(s[0]);
	long r = Long.parseLong(s[1]);
	long x = Long.parseLong(s[2]);
	long y = Long.parseLong(s[3]);
	long p = y*x;
	long top = (long)Math.sqrt(y*x);
	long ans = 0;
	long aux = 0;
	for(long i = x;i<=top;i+=x){
	    aux = p/i;
	    if(p%i==0 && gcd(i,aux)==x && i>=l && i<=r && aux>=l && aux<=r){
		if(i!=(aux)){
		    ans+=2;
		}else{
		    ans++;
		}
	    }

	}
	out.println(ans);
    	out.close();
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long d = y / x;
            long count = 0;
            for (int i = 1; i <= (int) Math.sqrt(d); i++) {
                if (d % i == 0) {
                    long b = d / i;
                    if (gcd((long) i, b) == 1L) {
                        long A = i * x;
                        long B = b * x;
                        if (A >= l && A <= r && B >= l && B <= r && A * B == x * y) {
                            if (A != B) count += 2;
                            else count += 1;
                        }
                    }
                }
            }
            out.print(count);
        }

        private long gcd(long a, long b) {
            long c;
            while (a != 0) {
                c = a;
                a = b % a;
                b = c;
            }
            return b;
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.util.*;
import java.io.*;

public class _992_B_NastyaStudiesInformatics {

	public static void main(String[] args) throws IOException {
		long l = readInt(), r = readInt(), x = readInt(), y = readInt();
		HashSet<Long> factors = new HashSet<>();
		for(int i = 1; i<=Math.sqrt(y); i++) if(y%i == 0) {factors.add((long) i); factors.add((long) (y/i));}
		int cnt = 0; for(long i : factors) if(i >= l && i <= r) for(long j : factors)
			if(j >= l && j <= r && GCD(i, j) == x && (i*j)/GCD(i, j) == y) cnt++;
		println(cnt);
		exit();
	}

	public static long GCD(long a, long b) {
		return a*b == 0 ? a+b : GCD(b, a%b);
	}

	final private static int BUFFER_SIZE = 1 << 16;
	private static DataInputStream din = new DataInputStream(System.in);
	private static byte[] buffer = new byte[BUFFER_SIZE];
	private static int bufferPointer = 0, bytesRead = 0;
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	public static String readLine() throws IOException {
		byte[] buf = new byte[64]; // line length
		int cnt = 0, c;
		while ((c = Read()) != -1) {
			if (c == '\n')
				break;
			buf[cnt++] = (byte) c;
		}
		return new String(buf, 0, cnt);
	}

	public static String read() throws IOException {
		byte[] ret = new byte[1024];
		int idx = 0;
		byte c = Read();
		while (c <= ' ') {
			c = Read();
		}
		do {
			ret[idx++] = c;
			c = Read();
		} while (c != -1 && c != ' ' && c != '\n' && c != '\r');
		return new String(ret, 0, idx);
	}

	public static int readInt() throws IOException {
		int ret = 0;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');

		if (neg)
			return -ret;
		return ret;
	}

	public static long readLong() throws IOException {
		long ret = 0;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();
		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');
		if (neg)
			return -ret;
		return ret;
	}

	public static double readDouble() throws IOException {
		double ret = 0, div = 1;
		byte c = Read();
		while (c <= ' ')
			c = Read();
		boolean neg = (c == '-');
		if (neg)
			c = Read();

		do {
			ret = ret * 10 + c - '0';
		} while ((c = Read()) >= '0' && c <= '9');

		if (c == '.') {
			while ((c = Read()) >= '0' && c <= '9') {
				ret += (c - '0') / (div *= 10);
			}
		}

		if (neg)
			return -ret;
		return ret;
	}

	private static void fillBuffer() throws IOException {
		bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
		if (bytesRead == -1)
			buffer[0] = -1;
	}

	private static byte Read() throws IOException {
		if (bufferPointer == bytesRead)
			fillBuffer();
		return buffer[bufferPointer++];
	}

	static void print(Object o) {
		pr.print(o);
	}

	static void println(Object o) {
		pr.println(o);
	}

	static void flush() {
		pr.flush();
	}

	static void println() {
		pr.println();
	}

	static void exit() throws IOException {
		din.close();
		pr.close();
		System.exit(0);
	}
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class TryB
{

    static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}

		public String rs() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

    static long mod=1000000007;
    static BigInteger bigInteger = new BigInteger("1000000007");
    static int n = (int)1e6;
    static boolean[] prime;
    static ArrayList<Long> as;
    static void sieve() {
			Arrays.fill(prime	, true);
			prime[0] = prime[1] = false;
			for(int i = 2 ; i * i <= n ; ++i) {
				if(prime[i]) {
					for(int k = i * i; k< n ; k+=i) {
						prime[k] = false;
					}
				}
			}

		}
		static PrintWriter w = new PrintWriter(System.out);

    public static void main(String[] args)
    {

        InputReader sc = new InputReader(System.in);
        //PrintWriter w = new PrintWriter(System.out);

       /*
        prime  = new boolean[n + 1];
		sieve();
		prime[1] = false;
		*/
		/*
		as = new ArrayList<>();
		for(int i=2;i<=1000000;i++)
		{
		    if(prime[i])
		    as.add(i);
		}
		*/

       /*

	long a = sc.nl();

            BigInteger ans = new BigInteger("1");
            for (long i = 1; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    if (a / i == i) {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));

                    } else {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        ans = ans.multiply(BigInteger.valueOf(phi(a / i)));

                    }

                }
            }
            w.println(ans.mod(bigInteger));
            */

      long l = sc.nl();
      long r = sc.nl();
      long x = sc.nl();
      long y = sc.nl();
      long p = x*y;
      long res = 0;
      if(l > y)
          w.println("0");
      else
      {
          for(long i=x;i*i<=p;i+=x)
          {
              if(p%i==0 && p/i<=r && p/i >=l && i>=l && i <=r)
              {
              if(gcd(i,p/i)==x && lcm(i,p/i)==y)
              {
                  if(p/i == i)
                      res++;
                  else
                      res += 2;
              }
              }
          }

      w.println(res);
      }
      /*
      for(int i=0;i<as.size();i++)
      {
          w.print(as.get(i) +" ");
      }
      */
      /*
      long res = 0;
      for(int i=0;i<as.size();i++)
      {
          if(as.get(i) >= l && as.get(i) <= r)
          {
              long te = p/as.get(i);

              if(p%as.get(i) == 0)
              {
                  if(te >=l && te <= r)
                  {
                      if(gcd(te, as.get(i)) == x)
                      {
                      if(te == as.get(i) || as.contains(te))
                          res++;
                      else
                          res += 2;
                      }
                  }
              }

          }
      }
      w.println(res);

  */

      w.close();

    }
    static int opens(String p)
    {
        int c = 0;
        for(int i=0;i<p.length();i++)
        {
            if(p.charAt(i) == '(')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
    static int closes(String p)
    {
        int c = 0;
        for(int i=p.length()-1;i>=0;i--)
        {
            if(p.charAt(i) == ')')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
     static long modexp(long x,long n,long M)
{
    long power = n;
    long result=1;
    while(power>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        power = power/2;
    }
    return result;
}
     static long modInverse(long A,long M)
{
    return modexp(A,M-2,M);
}

     public static long modMultiply(long one, long two) {

		return (one % mod * two % mod) % mod;
	}
    static long fx(int m)
    {
        long re = 0;
        for(int i=1;i<=m;i++)
        {
            re += (long) (i / gcd(i,m));
        }
        return re;
    }
     static long gcd(long a, long b)
    {
	 if (a == 0)
	  return b;

	return gcd(b%a, a);
    }
     static long lcm(long a, long b)
    {
	 return (a*b)/gcd(a, b);
    }

     static long phi(long nx)
    {
        // Initialize result as n
        double result = nx;

        // Consider all prime factors of n and for
        // every prime factor p, multiply result
        // with (1 - 1/p)
        for (int p = 0; as.get(p) * as.get(p) <= nx; ++p)
        {
            // Check if p is a prime factor.
            if (nx % as.get(p) == 0)
            {
                // If yes, then update n and result
                while (nx % as.get(p) == 0)
                    nx /= as.get(p);
                result *= (1.0 - (1.0 / (double) as.get(p)));
            }
        }

        // If n has a prime factor greater than sqrt(n)
        // (There can be at-most one such prime factor)
        if (nx > 1)
            result *= (1.0 - (1.0 / (double) nx));

        return (long)result;

        //return(phi((long)result,k-1));

    }

    public static void primeFactors(long n,long c,long d)
    {
        long sum = 0;
        // Print the number of 2s that divide n
        as = new ArrayList<>();
       if(d%n == 0)
            as.add(n);
        while (n%2==0)
        {
            sum = 1;
            //System.out.print(2 + " ");
            n /= 2;
            if(d%n == 0)
            as.add(n);
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (long i = 3; i <= (long)Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n

            while (n%i == 0)
            {

               // System.out.print(i + " ");
                if(d%n == 0)
                as.add(n);
                n /= i;

            }
            sum++;
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2

    }
    static int digitsum(int x)

    {

        int sum = 0;
        while(x > 0)
        {
            int temp = x % 10;
            sum += temp;
            x /= 10;
        }
        return sum;

    }
    static int countDivisors(int n)
    {
        int cnt = 0;
        for (int i = 1; i*i <=n; i++)
        {
             if (n % i == 0 && i<=1000000)
             {
                // If divisors are equal,
                // count only one
                if (n / i == i)
                   cnt++;

                else // Otherwise count both
                    cnt = cnt + 2;
             }
         }
        return cnt;
    }

    static boolean isprime(int n)
    {

    if(n == 2)
        return true;
    if(n == 3)
        return true;
    if(n % 2 == 0)
        return false;
    if(n % 3 == 0)
        return false;

    int i = 5;
   int w = 2;

    while(i * i <= n)
    {
        if(n % i == 0)
            return false;

        i += w;
        w = 6 - w;
    }

    return true;
    }

    static long log2(long value) {
    return Long.SIZE-Long.numberOfLeadingZeros(value);
}

    static boolean binarysearch(int []arr,int p,int n)
    {
        //ArrayList<Integer> as = new ArrayList<>();
        //as.addAll(0,at);
        //Collections.sort(as);
        boolean re = false;
        int st = 0;
        int end = n-1;

        while(st <= end)
        {
            int mid = st + (end-st)/2;

            if(p > arr[mid])
            {
                st = mid+1;

            }
            else if(p < arr[mid])
            {
                end = mid-1;

            }
            else if(p == arr[mid])
            {

            re = true;
            break;
            }

        }
         return re;

    }

    static class Student
    {

        int position;
        int value;
        Student(int position,int value)
        {
            this.position = position;
            this.value = value;

        }

    }
    /* Java program for Merge Sort */
static class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    /* A utility function to print array of size n */

}

    public static int ip(String s){
		return Integer.parseInt(s);
	}
	 public static String ips(int s){
		return Integer.toString(s);
	}

}

//package main;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	static List<Integer> primeGenerator(int max) {
		boolean[] isNotPrime = new boolean[max];

		for(int i = 2; i < max; i++) {
			if(isNotPrime[i]) continue;

			isNotPrime[i] = false;
			for(int j = i + i; j < max; j += i) {
				isNotPrime[j] = true;
			}
		}

		List<Integer> list = new ArrayList<Integer>();

		for(int i = 2; i < max; i++) {
			if(!isNotPrime[i]) list.add(i);
		}

		return list;
	}

	static List<Long> getPrimeFactors(long n) {
		List<Integer> primes = primeGenerator(1000001);

		List<Long> primeFactors = new ArrayList<>();

		int index = 0;
		while(n > 1 && index < primes.size()) {
			int prime = primes.get(index);
			int pow = 0;
			while(n % prime == 0) {
				n /= prime;
				pow++;
			}
			index++;
			if(pow > 0)
				primeFactors.add((long)Math.pow(prime, pow));
		}
		if(n > 1)
			if(isPrime((int)n)) primeFactors.add(n);
			else System.exit(31);

		return primeFactors;

	}

	static class Pair {
		long value;
		int index;
		Pair(long value, int index) {
			this.value = value;
			this.index = index;
		}
	}

	static boolean isPrime(int n) {
		if(n % 2 == 0) return false;

		int sqrt = (int)Math.sqrt(n);

		for(int i = 3; i <= sqrt; i += 2) {
			if(n % i == 0) return false;
		}

		return true;
	}

	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] data = reader.readLine().split("\\s+");
		reader.close();

		long l = Integer.parseInt(data[0]);
		long r = Integer.parseInt(data[1]);
		long x = Integer.parseInt(data[2]);
		long y = Integer.parseInt(data[3]);

		if((y % x) != 0) {
			System.out.println(0);
			return;
		}

		if(x == y) {
			if(x < l || y > r) System.out.println(0);
			else System.out.println(1);
			return;
		}

		long part = y / x;

		List<Long> primeFactors = getPrimeFactors(part);

		List<Pair> temp1 = new ArrayList<>();

		int ans = 0;

		for(int i = 0; i < primeFactors.size(); i++) {
			long val = primeFactors.get(i);
			long f1 = x * (val);
			long f2 = x * (part / val);

			if(Math.min(f1, f2) >= l && Math.max(f1, f2) <= r) ans++;

			temp1.add(new Pair(val, i+1));

		}

		List<Pair> temp2 = new ArrayList<>();
		while(!temp1.isEmpty()) {
			temp2.clear();
			for(Pair p: temp1) {
				for(int i = p.index; i < primeFactors.size(); i++) {
					long val = p.value * primeFactors.get(i);
					long f1 = x * (val);
					long f2 = x * (part / val);

					if(Math.min(f1, f2) >= l && Math.max(f1, f2) <= r) ans++;

					temp2.add(new Pair(val, i + 1));
				}
			}

			List<Pair> temp = temp1;
			temp1 = temp2;
			temp2 = temp;
		}

		if(x >= l && y <= r) ans++;

		System.out.println(ans);
	}
}

import java.util.*;
import java.io.*;
public class B {

	static int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
		public static void main(String[] args) throws IOException {
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter (System.out);
			int l=sc.nextInt(),r=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
			int ans=0;
			if(y%x==0) {
				int target=y/x;

				for(int i=1;i*i<=target;i++)
				{
					if(target%i!=0)
						continue;
					int j=target/i;
					long a=i*1L*x,b=j*1L*x;
					if(a>=l && a<=r && b>=l && b<=r && gcd(i,j)==1)
						ans+=a==b?1:2;

				}

			}
			pw.println(ans);

			pw.close();
		}

	static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException { return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}

    }

}

import java.util.Scanner;

import static java.lang.System.out;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int l, r, x, y;
        l = s.nextInt();
        r = s.nextInt();
        x = s.nextInt();
        y = s.nextInt();

        if (y % x != 0) {
            out.println(0);
            return;
        }

        int k = y / x;
        int ans = 0;

        for (int c = 1; c * c <= k; c++) {
            if (k % c != 0)
                continue;
            int d = k / c;
            if (inRange(l, r, c * x) && inRange(l, r, d * x) && gcd(c, d) == 1) {
                if (c == d)
                    ans++;
                else
                    ans += 2;
            }
        }

        out.println(ans);
    }

    private static int gcd(int c, int d) {
        while (d > 0) {
            int tmp = c % d;
            c = d;
            d = tmp;
        }
        return c;
    }

    private static boolean inRange(int from, int to, int num) {
        return num <= to && num >= from;
    }
}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Solution
{
    static class InputReader
	{
	    private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

	    public InputReader(InputStream st) {
	      this.stream = st;
	    }

	    public int read() {
	      if (snumChars == -1)
	        throw new InputMismatchException();
	      if (curChar >= snumChars) {
	        curChar = 0;
	        try {
	          snumChars = stream.read(buf);
	        } catch (IOException e) {
	          throw new InputMismatchException();
	        }
	        if (snumChars <= 0)
	          return -1;
	      }
	      return buf[curChar++];
	    }

	    public int nextInt() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      int res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public long nextLong() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      long res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public int[] nextIntArray(int n) {
	      int a[] = new int[n];
	      for (int i = 0; i < n; i++) {
	        a[i] = nextInt();
	      }
	      return a;
	    }

	    public String readString() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isSpaceChar(c));
	      return res.toString();
	    }

	    public String nextLine() {
	      int c = read();
	      while (isSpaceChar(c))
	        c = read();
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isEndOfLine(c));
	      return res.toString();
	    }

	    public boolean isSpaceChar(int c) {
	      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }

	    private boolean isEndOfLine(int c) {
	      return c == '\n' || c == '\r' || c == -1;
	    }
	}
    public static int gcd(int a,int b)
    {
        if(a==0)
            return b;

        return gcd(b%a,a);
    }
    public static void main(String[] args) throws IOException
    {
        InputReader in=new InputReader(System.in);
        int l=in.nextInt();
        int r=in.nextInt();
        int x=in.nextInt();
        int y=in.nextInt();
        if(y%x!=0)
        {
            System.out.println("0");
            return;
        }
        int num=y/x;
        ArrayList<Integer> list=new ArrayList<Integer>();
        long count=0;
        for(int i=1;i<=(int)Math.sqrt(y/x);i++)
        {
            if(num%i==0)
            {
                if(i*x>=l && i*x<=r && (num/i)*x>=l && (num/i)*x<=r && gcd(num/i,i)==1)
                {
                    if(i!=num/i)
                    {
                        count+=2L;
                    }
                    else
                    {
                        count+=1L;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

import java.io.*;
import java.util.*;

public class B {

	static long gcd(long a ,long b)
    {
        if(b==0)
            return a;
        return gcd(b ,a%b);
    }

	public static void main(String[] args) {

		FastScanner s = new FastScanner();
		long l,r,x,y;
		l = s.nextLong();
		r = s.nextLong();
		x = s.nextLong();
		y = s.nextLong();

		long X = x*y;
		long d = x;
		long ans = 0;
		while(d*d<=X)
		{
			if(X%d==0)
			{
				long f1 = d;
				long f2 = X/d;

				if(gcd(f1,f2)==x)
				{
					if(f1>=l&&f1<=r&&f2>=l&&f2<=r)
					{
						if(f1!=f2)
							ans+=2;
						else
							ans++;
					}
				}
			}
			d+=x;
			if(d>r)
				break;
		}
		System.out.println(ans);

	}
static class FastScanner {

	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;

		}

	}

}

import java.io.*;
import java.util.*;
public class B2
{
    private static long gcd(long a, long b)
    {
        if(a==0)
        return b;

        return gcd(b%a,a);
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        long l,r,x,y,i,ans=0,tmp,c,d;

        System.out.println(); //comment this line
        String s[]=br.readLine().trim().split(" ");

        l=Long.parseLong(s[0]);
        r=Long.parseLong(s[1]);
        x=Long.parseLong(s[2]);
        y=Long.parseLong(s[3]);

        if(y%x!=0)
        {
            System.out.println(0);
            System.exit(0);
        }

        tmp=y/x;

        for(i=1;i<=(long)(Math.sqrt(tmp));i++)
        {
            if(tmp%i==0)
            {
                c=i;
                d=tmp/i;

                if(gcd(c,d)==1&&l<=c*x&&d*x<=r)
                {
                    if(c*c==tmp)
                    ans+=1;
                    else
                    ans+=2;
                }
            }
        }

        System.out.println(ans);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

/*
 * Author    : joney_000[jaswantsinghyada007@gmail.com]
 * Algorithm : N/A
 * Platform  : Codeforces
 * Ref       :
 */

public class A{

  private InputStream inputStream ;
  private OutputStream outputStream ;
  private FastReader in ;
  private PrintWriter out ;

  private final int BUFFER = 100005;
  private final long mod = 1000000000+7;
  private final int  INF  = Integer.MAX_VALUE;
  private final long INF_L  = Long.MAX_VALUE / 10;

  public A(){}
  public A(boolean stdIO)throws FileNotFoundException{
    // stdIO = false;
    if(stdIO){
      inputStream = System.in;
      outputStream = System.out;
    }else{
      inputStream = new FileInputStream("input.txt");
      outputStream = new FileOutputStream("output.txt");
    }
    in = new FastReader(inputStream);
    out = new PrintWriter(outputStream);
  }

  void run()throws Exception{
    long l = i(); long r = i(); long x = i(); long y = i();
    long ans = 0;
    long g = x;

    if(y % g != 0){
      out.write("0");
      return;
    }

    long s = y / g;

    for(long i = 1; i * i <= s; i++){

      long val = i;
      if(s % val == 0){
        long p = val;
        long q = s/val;

        if(p*g <= r && q*g <= r && p*g >= l && q*g >= l && (gcd(p , q) == 1)){

          if(p == q)ans++;
          else ans += 2;
        }
      }
    }
    out.write(""+ans+"\n");
  }

  long gcd(long a, long b){
    if(b == 0)return a;
    return gcd(b, a % b);
  }

  long lcm(long a, long b){
    if(a == 0 || b == 0)return 0;
    return (a * b)/gcd(a, b);
  }

  long mulMod(long a, long b, long mod){
    if(a == 0 || b == 0)return 0;
    if(b == 1)return a;
    long ans = mulMod(a, b/2, mod);
    ans = (ans * 2) % mod;
    if(b % 2 == 1)ans = (a + ans)% mod;
    return ans;
  }

  long pow(long a, long b, long mod){
    if(b == 0)return 1;
    if(b == 1)return a;
    long ans = pow(a, b/2, mod);
    ans = (ans * ans);
    if(ans >= mod)ans %= mod;

    if(b % 2 == 1)ans = (a * ans);
    if(ans >= mod)ans %= mod;

    return ans;
  }

  // 20*20   nCr Pascal Table
  long[][] ncrTable(){
    long ncr[][] = new long[21][21];

    for(int i = 0; i <= 20; i++){
      ncr[i][0] = ncr[i][i] = 1L;
    }

    for(int j = 0; j <= 20; j++){
      for(int i = j + 1; i <= 20; i++){
        ncr[i][j] = ncr[i-1][j] + ncr[i-1][j-1];
      }
    }

    return ncr;
  }

  int i()throws Exception{
    return in.nextInt();
  }

  long l()throws Exception{
    return in.nextLong();
  }

  double d()throws Exception{
    return in.nextDouble();
  }

  char c()throws Exception{
    return in.nextCharacter();
  }

  String s()throws Exception{
    return in.nextLine();
  }

  BigInteger bi()throws Exception{
    return in.nextBigInteger();
  }

  private void closeResources(){
    out.flush();
    out.close();
    return;
  }

//  IMP: roundoff upto 2 digits
//  double roundOff = Math.round(a * 100.0) / 100.0;
//                    or
//  System.out.printf("%.2f", val);

//  print upto 2 digits after decimal
//  val = ((long)(val * 100.0))/100.0;

  public static void main(String[] args) throws java.lang.Exception{

    A driver = new A(true);
    driver.run();
    driver.closeResources();
  }
}

class FastReader{

  private boolean finished = false;

  private InputStream stream;
  private byte[] buf = new byte[4 * 1024];
  private int curChar;
  private int numChars;
  private SpaceCharFilter filter;

  public FastReader(InputStream stream){
    this.stream = stream;
  }

  public int read(){
    if (numChars == -1){
      throw new InputMismatchException ();
    }
    if (curChar >= numChars){
      curChar = 0;
      try{
        numChars = stream.read (buf);
      } catch (IOException e){
        throw new InputMismatchException ();
      }
      if (numChars <= 0){
        return -1;
      }
    }
    return buf[curChar++];
  }

  public int peek(){
    if (numChars == -1){
      return -1;
    }
    if (curChar >= numChars){
      curChar = 0;
      try{
        numChars = stream.read (buf);
      } catch (IOException e){
        return -1;
      }
      if (numChars <= 0){
        return -1;
      }
    }
    return buf[curChar];
  }

  public int nextInt(){
    int c = read ();
    while (isSpaceChar (c))
      c = read ();
    int sgn = 1;
    if (c == '-'){
      sgn = -1;
      c = read ();
    }
    int res = 0;
    do{
      if(c==','){
        c = read();
      }
      if (c < '0' || c > '9'){
        throw new InputMismatchException ();
      }
      res *= 10;
      res += c - '0';
      c = read ();
    } while (!isSpaceChar (c));
    return res * sgn;
  }

  public long nextLong(){
    int c = read ();
    while (isSpaceChar (c))
      c = read ();
    int sgn = 1;
    if (c == '-'){
      sgn = -1;
      c = read ();
    }
    long res = 0;
    do{
      if (c < '0' || c > '9'){
        throw new InputMismatchException ();
      }
      res *= 10;
      res += c - '0';
      c = read ();
    } while (!isSpaceChar (c));
    return res * sgn;
  }

  public String nextString(){
    int c = read ();
    while (isSpaceChar (c))
      c = read ();
    StringBuilder res = new StringBuilder ();
    do{
      res.appendCodePoint (c);
      c = read ();
    } while (!isSpaceChar (c));
    return res.toString ();
  }

  public boolean isSpaceChar(int c){
    if (filter != null){
      return filter.isSpaceChar (c);
    }
    return isWhitespace (c);
  }

  public static boolean isWhitespace(int c){
    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
  }

  private String readLine0(){
    StringBuilder buf = new StringBuilder ();
    int c = read ();
    while (c != '\n' && c != -1){
      if (c != '\r'){
        buf.appendCodePoint (c);
      }
      c = read ();
    }
    return buf.toString ();
  }

  public String nextLine(){
    String s = readLine0 ();
    while (s.trim ().length () == 0)
      s = readLine0 ();
    return s;
  }

  public String nextLine(boolean ignoreEmptyLines){
    if (ignoreEmptyLines){
      return nextLine ();
    }else{
      return readLine0 ();
    }
  }

  public BigInteger nextBigInteger(){
    try{
      return new BigInteger (nextString ());
    } catch (NumberFormatException e){
      throw new InputMismatchException ();
    }
  }

  public char nextCharacter(){
    int c = read ();
    while (isSpaceChar (c))
      c = read ();
    return (char) c;
  }

  public double nextDouble(){
    int c = read ();
    while (isSpaceChar (c))
      c = read ();
    int sgn = 1;
    if (c == '-'){
      sgn = -1;
      c = read ();
    }
    double res = 0;
    while (!isSpaceChar (c) && c != '.'){
      if (c == 'e' || c == 'E'){
        return res * Math.pow (10, nextInt ());
      }
      if (c < '0' || c > '9'){
        throw new InputMismatchException ();
      }
      res *= 10;
      res += c - '0';
      c = read ();
    }
    if (c == '.'){
      c = read ();
      double m = 1;
      while (!isSpaceChar (c)){
        if (c == 'e' || c == 'E'){
          return res * Math.pow (10, nextInt ());
        }
        if (c < '0' || c > '9'){
          throw new InputMismatchException ();
        }
        m /= 10;
        res += (c - '0') * m;
        c = read ();
      }
    }
    return res * sgn;
  }

  public boolean isExhausted(){
    int value;
    while (isSpaceChar (value = peek ()) && value != -1)
      read ();
    return value == -1;
  }

  public String next(){
    return nextString ();
  }

  public SpaceCharFilter getFilter(){
    return filter;
  }

  public void setFilter(SpaceCharFilter filter){
    this.filter = filter;
  }

  public interface SpaceCharFilter{
    public boolean isSpaceChar(int ch);
  }
}

class Pair implements Comparable<Pair>{
  public int a;
  public int b;
  public int c;

  public Pair(){
    this.a = 0;
    this.b = 0;
    this.c = 0;
  }

  public Pair(int a,int b, int c){
    this.a = a;
    this.b = b;
    this.c = c;
  }

  public int compareTo(Pair p){
   return this.c - p.c;
  }

  @Override
  public String toString(){
    return "a = " + this.a + " b = " + this.b + " c = "+this.c;
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long x = in.nextInt();
            long y = in.nextInt();
            long yx = y / x;
            long ans = 0;
            for (long k1 = 1; k1 * k1 <= yx; k1++) {
                if (yx % k1 == 0) {
                    long a = x * k1;
                    long b = x * yx / k1;
                    if (l <= a && a <= r && l <= b && b <= r && gcd(a, b) == x && lcm(a, b) == y) {
                        if (a == b) ans++;
                        else ans += 2;
                    }
                }
            }
            out.println(ans);
        }

        long gcd(long a, long b) {
            if (b == 0) return a;
            return gcd(b, a % b);
        }

        long lcm(long a, long b) {
            return (a * b) / gcd(a, b);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.*;
import java.util.*;
public class B2
{
    private static long gcd(long a, long b)
    {
        if(a==0)
        return b;

        return gcd(b%a,a);
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        long l,r,x,y,i,ans=0,tmp,c,d;

        System.out.println(); //comment this line
        String s[]=br.readLine().trim().split(" ");

        l=Long.parseLong(s[0]);
        r=Long.parseLong(s[1]);
        x=Long.parseLong(s[2]);
        y=Long.parseLong(s[3]);

        if(y%x!=0)
        {
            System.out.println(0);
            System.exit(0);
        }

        tmp=y/x;

        for(i=1;i<=(long)(Math.sqrt(tmp));i++)
        {
            if(tmp%i==0)
            {
                c=i;
                d=tmp/i;

                if(gcd(c,d)==1&&l<=c*x&&c*x<=r&&l<=d*x&&d*x<=r)
                {
                    if(c*c==tmp)
                    ans+=1;
                    else
                    ans+=2;
                }
            }
        }

        System.out.println(ans);
    }
}

import java.io.*;
import java.util.*;
public class B2
{
    private static long gcd(long a, long b)
    {
        if(a==0)
        return b;

        return gcd(b%a,a);
    }
    public static void main(String args[]) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        long l,r,x,y,i,ans=0,tmp,c,d;

        System.out.println(); //comment this line
        String s[]=br.readLine().trim().split(" ");

        l=Long.parseLong(s[0]);
        r=Long.parseLong(s[1]);
        x=Long.parseLong(s[2]);
        y=Long.parseLong(s[3]);

        if(y%x!=0)
        {
            System.out.println(0);
            System.exit(0);
        }
        if(y==x)
        {
            if(y>=l&&y<=r)
            System.out.println(1);
            else
            System.out.println(0);

            System.exit(0);
        }

        tmp=y/x;

        for(i=1;i<=(long)(Math.sqrt(tmp));i++)
        {
            if(tmp%i==0)
            {
                c=i;
                d=tmp/i;

                if(gcd(c,d)==1&&l<=c*x&&d*x<=r)
                {
                    ans+=2;
                }
            }
        }

        System.out.println(ans);
    }
}

//package R489DIV2;
/**
 * Created by ankurverma1994
 * My code is awesome!
 */

import java.io.*;
import java.util.*;
import java.math.*;

public class ProbB {
    final int mod = (int) 1e9 + 7;
    final double eps = 1e-6;
    final double pi = Math.PI;
    final long inf = Long.MAX_VALUE / 2;

    //------------> Solution starts here!!
    @SuppressWarnings("Main Logic")
    void solve() {
        long l = il(), r = il();
        int gcd = ii(), lcm = ii();
        if (lcm % gcd != 0) {
            out.println(0);
            return;
        }
        int num = lcm / gcd;
        long fac[] = new long[20];
        int index = 0;
        long a = 1;
        while (num % 2 == 0) {
            num /= 2;
            a *= 2;
        }
        if (a * gcd > r) {
            out.println(0);
            return;
        }
        if (a != 1) {
            fac[index++] = a;
        }
        for (int i = 3; i <= Math.sqrt(num); i += 2) {
            a = 1;
            while (num % i == 0) {
                num /= i;
                a *= i;
            }
            if (a * gcd > r) {
                out.println(0);
                return;
            }
            if (a != 1) {
                fac[index++] = a;
            }
        }
        if (num > 2) {
            if (num * gcd > r) {
                out.println(0);
                return;
            }
            fac[index++] = num;
        }
        num = lcm / gcd;
        Set<String> ans = new HashSet<>();
        for (int counter = 0; counter < (1 << index); counter++) {
            long x = 1;
            for (int j = 0; j < index; j++) {
                if ((counter & (1 << j)) > 0) {
                    x *= fac[j];
                }
            }
            long y = num / x;
            x *= gcd;
            y *= gcd;
            if (l <= x && x <= r && l <= y && y <= r) ans.add(x + " " + y);
        }
        out.println(ans.size());
    }

    //------------> Solution ends here!!
    InputStream obj;
    PrintWriter out;
    String check = "";

    public static void main(String[] args) throws IOException {
        new Thread(null, new Runnable() {
            public void run() {
                try {
                    new ProbB().main1();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (StackOverflowError e) {
                    System.out.println("RTE");
                }
            }
        }, "1", 1 << 26).start();
    }

    void main1() throws IOException {
        out = new PrintWriter(System.out);
        obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());
        // obj=check.isEmpty() ? new FileInputStream("/home/ankurverma1994/input.txt") : new ByteArrayInputStream(check.getBytes());
        solve();
        out.flush();
        out.close();
    }

    byte inbuffer[] = new byte[1024];
    int lenbuffer = 0, ptrbuffer = 0;

    int readByte() {
        if (lenbuffer == -1) throw new InputMismatchException();
        if (ptrbuffer >= lenbuffer) {
            ptrbuffer = 0;
            try {
                lenbuffer = obj.read(inbuffer);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }
        if (lenbuffer <= 0) return -1;
        return inbuffer[ptrbuffer++];
    }

    String is() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) // when nextLine, (isSpaceChar(b) && b!=' ')
        {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    int ii() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    long il() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    boolean isSpaceChar(int c) {
        return (!(c >= 33 && c <= 126));
    }

    int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
        return b;
    }

    float nf() {
        return Float.parseFloat(is());
    }

    double id() {
        return Double.parseDouble(is());
    }

    char ic() {
        return (char) skip();
    }

    int[] iia(int n) {
        int a[] = new int[n];
        for (int i = 0; i < n; i++) a[i] = ii();
        return a;
    }

    long[] ila(int n) {
        long a[] = new long[n];
        for (int i = 0; i < n; i++) a[i] = il();
        return a;
    }

    String[] isa(int n) {
        String a[] = new String[n];
        for (int i = 0; i < n; i++) a[i] = is();
        return a;
    }

    double[][] idm(int n, int m) {
        double a[][] = new double[n][m];
        for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = id();
        return a;
    }

    int[][] iim(int n, int m) {
        int a[][] = new int[n][m];
        for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = ii();
        return a;
    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputReader input_reader = new InputReader(System.in);
        OutputWriter output_writer = new OutputWriter(System.out);
        ProblemSolver solver = new ProblemSolver();
        solver.solve(input_reader, output_writer);
        output_writer.flush();
        output_writer.close();
    }

    private static class ProblemSolver {

        long GCD(long a, long b) {
            long x = Math.max(a,b);
            long y = Math.min(a,b);
            if (x%y==0l) {
                return y;
            }
            return GCD(x%y, y);
        }

        public void solve(InputReader input, OutputWriter output)
                throws IOException {
            long L = input.nextLong(), R = input.nextLong(), X = input.nextLong(), Y = input.nextLong();
            if (Y%X!=0) {
                output.printLine(0);
                output.flush();
                return;
            }
            int result = 0;
            for (long i=1;i*i<=Y/X;i++) {
                if ((Y/X)%i==0 && GCD((Y/X)/i, i)==1 && (Y)/i>=L && (Y)/i<=R && i*X>=L && i*X<=R) {
                    if (((Y/X)/i)==i) {
                        result++;
                        continue;
                    }
                    result+=2;
                }
            }
            output.printLine(result);
            output.flush();
        }
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

    private static class OutputWriter {

        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main
{

	long gcd(long a,long b)
	{
		if(a==0)
			return b;
		else
			return gcd(b%a,a);
	}

	boolean check(long a,long b,long x,long y)
	{
		long g = gcd(a,b);
		long l = (a*b)/g;

		if(g==x && l==y)
			return true;
		else
			return false;
	}

	boolean valid(long l,long r,long x)
	{
		if(l<=x && x<=r)
			return true;

		return false;
	}

	void solve()
	{
		FastReader sc =new FastReader();

		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		long num = x*y;
		long count = 0;

		for(long i=x;i<=Math.sqrt(num);i+=x)
		{
			if(num%i==0)
			{
				long f = i;
			    long s = (num/i);

				if(valid(l,r,f) && valid(l,r,s))
				{
					if(check(f,s,x,y))
					{
						if(f!=s)
							count+=2;
						else
							count++;
					}
				}
			}
		}

		System.out.println(count);
	}

    public static void main(String[] args)
    {
        new Main().solve();
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CS_81_D {
	public static long gcd(long a, long b) {
		return a == 0 ? b : gcd(b % a, a);
	}

	static int l;
	static int r;

	public static boolean in(int x) {
		return x >= l && x <= r;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		l = sc.nextInt();
		r = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int tot = 0;
		if (y % x != 0)
			System.out.println(0);
		else if (y == x)
			System.out.println(in(x) ? 1 : 0);
		else {
			int z = y / x;
			for (int i = 1; 1l * i * i <= z; i++) {
				if (z % i == 0) {
					if (gcd(i, z / i) == 1 && in(x * i) && in((z / i) * x)) {
						tot += 2;
					}

				}
			}
			System.out.println(tot);
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}

}

import static java.lang.Double.parseDouble;
import static java.lang.Double.max;
import static java.lang.Double.min;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.lang.System.gc;
import static java.lang.System.setOut;

import java.io.*;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    // 1 10 9 9
    // 1 12 1 12
    // 1 2 1 2

    static boolean between(long x, long a, long b) {
        return x >= a && x <= b;
    }

    static void solve() throws Exception {
        long l = nextLong(), r = nextLong(), x = nextLong(), y = nextLong(), ans = 0;
        Set<Long> set = new TreeSet<>();
        for(long i = 1; i <= Math.sqrt(y); i++) {
            if(y % i == 0) {
                set.add(i);set.add(y/i);
            }
        }
        long s = x * y;
        for(long a:set) {
            long b = s / a;
            if(set.contains(b) && gcd(a,b) == x && lcm(a,b) == y && between(a,l,r) && between(b,l,r)) ans ++;
        }
        System.out.println(ans);
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private static long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static double nextDouble() throws IOException {
        return parseDouble(next());
    }

    static String next() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            solve();
            //long lEndTime = System.currentTimeMillis();
            //System.out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Problem {

	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------
		/*
		 * int n = in.nextInt(); int arr[] = in.nextIntArray(n, 0);
		 * HashSet<Integer> set = new HashSet<Integer>(); for (int i = 0; i < n;
		 * i++) { if (arr[i] != 0) set.add(arr[i]); }
		 * System.out.println(set.size());
		 */
		long l, r, x, y;

		l = in.nextLong();
		r = in.nextLong();
		x = in.nextLong();
		y = in.nextLong();

		long xy = x * y;
		long ans = 0;
		for (long i = x; i <= (long) Math.sqrt(xy); i += x) {
			if (xy % i == 0) {
				long j = xy / i;
				if (gcd(j, i) == x && j >= l && j <= r && i >= l && i <= r) {
					if (j == i) {
						ans++;
					} else {
						ans += 2;
					}
				}
			}
		}
		System.out.println(ans);
		// ---------------The End------------------

		out.close();
	}

	static boolean isPossible(int x, int y) {
		if (x >= 0 && y >= 0 && x < 4 && y < 4)
			return true;
		return false;
	}
	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}

//package com.company;

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
    static long TIME_START, TIME_END;
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(new FileInputStream("Test.in"));
        PrintWriter pw = new PrintWriter(System.out);
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.out"));
//        PrintWriter pw = new PrintWriter(new FileOutputStream("Test.in"));
        Runtime runtime = Runtime.getRuntime();
        long usedMemoryBefore = runtime.totalMemory() - runtime.freeMemory();
        TIME_START = System.currentTimeMillis();
        Task t = new Task();
        t.solve(sc, pw);
        TIME_END = System.currentTimeMillis();
        long usedMemoryAfter = runtime.totalMemory() - runtime.freeMemory();
        pw.close();
        System.out.println("Memory increased:" + (usedMemoryAfter-usedMemoryBefore) / 1000000 );
        System.out.println("Time used: " + (TIME_END - TIME_START) + ".");
    }

    public static class Task {
        public int gcd(int a, int b) { return b==0 ? a : gcd(b, a%b); }
        public int ceilDic(int a, int b) {
            return a % b == 0 ? a / b : a / b + 1;
        }
        public void solve(Scanner sc, PrintWriter pw) throws IOException {
            int l = sc.nextInt();
            int r = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (y % x != 0) {
                pw.println(0);
                return;
            }
            int mult = y / x;
            int cnt = 0;
            for (int i = 1; i * i <= mult; i++) {
                if (mult % i == 0 ) {
                    int j = mult / i;
                    if (gcd(i, j) == 1){
                        boolean inI = l <= i * x && i * x <= r;
                        boolean inJ = l <= j * x && j * x <= r;
                        if (inI && inJ) {
                            cnt += i == j ? 1 : 2;
                        }
                    }
                }
            }

            pw.println(cnt);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public Scanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException { return Double.parseDouble(next()); }

        public boolean ready() throws IOException {return br.ready();}
    }
}

import static java.lang.Double.parseDouble;
import static java.lang.Double.max;
import static java.lang.Double.min;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.lang.System.gc;
import static java.lang.System.setOut;

import java.io.*;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;

public class A {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    // 1 10 9 9
    // 1 12 1 12
    // 1 2 1 2

    static boolean between(long x, long a, long b) {
        return x >= a && x <= b;
    }

    static void solve() throws Exception {
        long l = nextLong(), r = nextLong(), x = nextLong(), y = nextLong(), ans = 0;
        Set<Long> set = new HashSet<>();
        for(long i = 1; i <= Math.sqrt(y); i++) {
            if(y % i == 0) {
                set.add(i);set.add(y/i);
            }
        }
        long s = x * y;
        for(long a:set) {
            long b = s / a;
            if(set.contains(b) && gcd(a,b) == x && lcm(a,b) == y && between(a,l,r) && between(b,l,r)) ans ++;
        }
        System.out.println(ans);
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }

    private static long lcm(long a, long b) {
        return a * (b / gcd(a, b));
    }

    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static double nextDouble() throws IOException {
        return parseDouble(next());
    }

    static String next() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    public static void main(String[] args) throws Exception {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            solve();
            //long lEndTime = System.currentTimeMillis();
            //System.out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Puneet
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInput in = new FastInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Taskaa solver = new Taskaa();
        solver.solve(1, in, out);
        out.close();
    }

    static class Taskaa {
        public void solve(int testNumber, FastInput in, PrintWriter out) {
            int l = in.ni(), r = in.ni(), x = in.ni(), y = in.ni();

            if (y % x != 0) {
                out.print("0");
                return;
            }

            int val = y / x;

            int x1 = (l / x);
            if (l % x != 0)
                x1++;

            int x2 = (r / x);

            //out.println(x1+" "+x2);

            int cnt = 0;

            for (int i = 1; i <= Math.sqrt(val); i++) {
                if (val % i == 0) {

                    if (i > x2 || i < x1 || (val / i) > x2 || (val / i) < x1)
                        continue;

                    if (gcd(i, val / i) != 1)
                        continue;

                    if (i != (val / i)) {
                        //out.println(i+" "+val/i);
                        cnt += 2;
                    } else
                        cnt++;
                }
            }

            out.print(cnt);

        }

        int gcd(int a, int b) {

            if (b == 0) return a;
            return gcd(b, a % b);
        }

    }

    static class FastInput {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastInput.SpaceCharFilter filter;

        public FastInput(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.math.BigInteger;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Puneet
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastInput in = new FastInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Taskaa solver = new Taskaa();
        solver.solve(1, in, out);
        out.close();
    }

    static class Taskaa {
        public void solve(int testNumber, FastInput in, PrintWriter out) {
            int l = in.ni(), r = in.ni(), x = in.ni(), y = in.ni();

            if (y % x != 0) {
                out.print("0");
                return;
            }

            int val = y / x;

            int x1 = (l / x);
            if (l % x != 0)
                x1++;

            int x2 = (r / x);

            //out.println(x1+" "+x2);

            int cnt = 0;

            for (int i = 1; i <= Math.sqrt(val); i++) {
                if (val % i == 0) {

                    if (i > x2 || i < x1 || (val / i) > x2 || (val / i) < x1)
                        continue;

                    if (gcd(i, val / i) != 1)
                        continue;

                    if (i != (val / i)) {
                        //out.println(i+" "+val/i);
                        cnt += 2;
                    } else
                        cnt++;
                }
            }

            out.print(cnt);

        }

        int gcd(int a, int b) {

            BigInteger b1 = BigInteger.valueOf(a);
            BigInteger b2 = BigInteger.valueOf(b);
            BigInteger gcd = b1.gcd(b2);
            return gcd.intValue();
        }

    }

    static class FastInput {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastInput.SpaceCharFilter filter;

        public FastInput(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long l = in.nextLong();
        long r = in.nextLong();
        long gcd = in.nextLong();
        long lcm = in.nextLong();

        ArrayList<Long> divisors = divisors(lcm);

        int count = 0;
        for(long a: divisors) {
            for(long b: divisors) {
                long g = gcd(a, b);
                if(g == gcd && a * b / g == lcm && a >= l && a <= r && b >= l && b <= r) {
                    count++;
                }
            }
        }
        System.out.println(count);
        in.close();
    }

    private static ArrayList<Long> divisors(long n) {
        ArrayList<Long> result = new ArrayList<>();
        for(long i = 1; i * i <= n; i++) {
            if(n % i == 0) {
                result.add(i);

                if(i * i != n)
                    result.add(n / i);
            }
        }

        return result;
    }

    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class English {
    public static void main(String[] z) throws Exception{
        Scanner s = new Scanner(System.in);
        long l = s.nextInt(), r=s.nextInt(), a=s.nextInt(), b=s.nextInt(), o=0, ch=b/a, k;
        if(b%a>0) System.out.println(0);
        else {
            ArrayList<Long> del = GetDel.get(ch);
            for(long i : del){
                k = ch/i;
                if(i*a>=l & i*a<=r & k*a>=l & k*a<=r & gcd(i,k)==1) o++;
            }
            System.out.println(o);
        }
    }

    static long gcd(long a, long b){
        for(; a!=0 && b!=0;){
            if(a>b) a%=b;
            else b%=a;
        }
        return a+b;
    }

    static class GetDel {

        static ArrayList<Long> k = new ArrayList<>();
        static long[] m;

        static ArrayList<Long> get(long ch){
            long c=1, del=1;
            int ks=0;
            ArrayList<Long> otv = new ArrayList<>();
            ArrayList<Long> t = f(ch);
            ks = k.size();
            m = new long[ks];
            long[] dl = new long[ks];
            long[] itr = new long[ks];
            for(int q=0; q<ks; q++) {
                m[q] = k.get(q);
                dl[q] = t.get(q);
                del*=k.get(q)+1;
            }
            for(; del>0; c=1, del--){
                for(int w=ks-1; w>=0; w--){
                    itr[w]++;
                    if(itr[w]>m[w]) {
                        itr[w]=0;
                    }
                    else break;
                }
                for(int u=0; u<ks; u++) c*=(long)Math.pow(dl[u], itr[u]);
                otv.add(c);
            }
            Collections.sort(otv);
            return otv;
        }

        static ArrayList<Long> f(long a){
            ArrayList<Long> l = new ArrayList<>();
            for(long d=2; d*d<=a; d++){
                if(a%d<1){
                    long u=0;
                    for(; a%d<1; ) {a/=d; u++;}
                    l.add(d);
                    k.add(u);
                }
            }
            if(a>1) {
                if(l.size()<1) {l.add(a); k.add((long)1);}
                else{
                    if(l.get(l.size()-1)!=a) {l.add(a); k.add((long)1);}
                    else{
                        k.add(k.get(k.size()-1)+1);
                        k.remove(k.size()-2);
                    }
                }
            }
            return l;
        }
    }
}

  //  package com.company;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.reflect.Array;
    import java.util.*;
    public class Main {

        public static void main(String[] args) throws IOException {
            Scanner s = new Scanner(System.in);
         //   BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
             StringBuilder sb = new StringBuilder();
            long l=s.nextLong();
            long r=s.nextLong();
            long x=s.nextLong();
            long y=s.nextLong();
            long p=x*y;long ans=0;
            for(long i=x;i<=Math.sqrt(x*y);i+=x){
                if(i>=l&&i<=r&&p%i==0&&p/i<=r&&(i*(p/i)/gcd((int)i,(int)(p/i))==y)&&gcd((int)i,(int)(p/i))==x){
                 //   System.out.println(":HI");
                    if(i!=p/i)
                    ans+=2;else ans+=1;
                }
            }
            System.out.println(ans);
        }
         static double power(double x, long y, int p) {
            double res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }
        public static void fracion(double x) {
            String a = "" + x;
            String spilts[] = a.split("\\."); // split using decimal
            int b = spilts[1].length(); // find the decimal length
            int denominator = (int) Math.pow(10, b); // calculate the denominator
            int numerator = (int) (x * denominator); // calculate the nerumrator Ex
            // 1.2*10 = 12
            int gcd = gcd(numerator, denominator); // Find the greatest common
            // divisor bw them
            String fraction = "" + numerator / gcd + "/" + denominator / gcd;
            // System.out.println((denominator/gcd));
            long x1=modInverse(denominator / gcd,998244353  );
            //  System.out.println(x1);
            System.out.println((((numerator / gcd )%998244353 *(x1%998244353  ))%998244353  ) );
        }static int max=Integer.MIN_VALUE;
static int max1=Integer.MIN_VALUE;static int[] ans;static long[][] dp;static int[][] c;
        public static int dfs(int papa, int i, ArrayList<Integer>[] h, int[] vis) {

             vis[i] = 1;
               if(papa!=-1){
                   dp[i-1][0]=Math.min(dp[i-1][0],c[0][i-1]+Math.min(dp[papa-1][1],dp[papa-1][2]));
                   dp[i-1][1]=Math.min(dp[i-1][1],c[1][i-1]+Math.min(dp[papa-1][0],dp[papa-1][2]));
                   dp[i-1][2]=Math.min(dp[i-1][2],c[2][i-1]+Math.min(dp[papa-1][1],dp[papa-1][0]));

               }else{
                   dp[i-1][0]=c[i-1][0];
                   dp[i-1][1]=c[i-1][1];
                   dp[i-1][2]=c[i-1][2];

               }
             for(Integer j:h[i]){
                      if(vis[j]==0){
                          dfs(i,j,h,vis);
                      }
             }ans[i]+=1;if(ans[i]>max){
                 max=ans[i];max1=i;
            }
          return ans[i];
        }

        public static void bfs(int i, HashMap<Integer, Integer>[] h, int[] vis, int len, int papa) {
            Queue<Integer> q = new LinkedList<Integer>();
            q.add(i);

        }

        static int i(String a) {
            return Integer.parseInt(a);
        }

        static long l(String a) {
            return Long.parseLong(a);
        }

        static String[] inp() throws IOException {
            BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
            return s.readLine().trim().split("\\s+");
        }

        static int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }
        static long modInverse(int a, int m)
        {

            {
                // If a and m are relatively prime, then modulo inverse
                // is a^(m-2) mode m
                return (power(a, m - 2, m));
            }
        }

        // To compute x^y under modulo m
        static long power(int x, int y, int m)
        {
            if (y == 0)
                return 1;

            long p = power(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

        // Function to return gcd of a and b

    }
    class Student
    {
        int l,r;

        public Student(int l, int r) {
            this.l = l;
            this.r = r;

        }
    // Constructor

        // Used to print student details in main()
        public String toString()
        {
            return this.l+" ";
        }
    }

    class Sortbyroll implements Comparator<Student>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Student a, Student b){
            return a.l-b.l;
        }
    }

import java.util.*;
public class Main {
    public static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    private static boolean isPrime(long num) {
        if (num < 2) return false;
        if (num == 2) return true;
        if (num % 2 == 0) return false;
        for (int i = 3; i * i <= num; i += 2)
            if (num % i == 0) return false;
        return true;
    }

    private static List<Long> ps(long n) {
        List<Long> result = new ArrayList<>();
        long p = 2;
        while(true) {
            if (isPrime(n)) {
                result.add(n);
                break;
            }
            else {
                while(n % p != 0) {
                    p++;
                    while(!isPrime(p)) p++;
                }
                result.add(p);
                n/=p;
            }
        }
        return result;
    }

    private static List<Long> lol(long n) {
        List<Long>ps = ps(n);
        List<Long>result = new ArrayList<>(ps);
        boolean bitmask [] = new boolean[ps.size() + 1];
        while(true) {
            int i = bitmask.length - 1;
            while (bitmask[i]) i--;
            if (i == 0) break;
            bitmask[i] = true;
            for (int j = i + 1; j < bitmask.length; j++) {
                bitmask[j] = false;
            }
            long c = 1;
            for (int j = 1; j < bitmask.length; j++) {
                if (bitmask[j]) {
                    c *= ps.get(j - 1);
                }
                //System.out.print(bitmask[j] ? 1 : 0);
            }
            result.add(c);
            //System.out.println();
            //System.out.println(c);
        }
        result.add(1L);
        result.add(n);
        return result;
    }

    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt(), r = scanner.nextInt(), x = scanner.nextInt(), y = scanner.nextInt();
        if (y % x == 0) {
            int ans = 0;
            for (int c = 1; c <= Math.sqrt(y / x); c++) {
                int cx = c * x;
                if (y % cx == 0) {
                    int d = y / cx;
                    int a = c * x;
                    int b = d * x;
                    if (a >= l && a <= r && b >= l && b <= r && gcd(c, d) == 1) {
                        if (c * c == y / x) ans++;
                        else ans+=2;
                    }
                }
            }
            System.out.println(ans);
        }
        else {
            System.out.println(0);
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {

	static InputReader in = new InputReader(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	static int oo = (int)1e9;

	public static void main(String[] args) throws IOException {

		long l = in.nextInt();
		long r = in.nextInt();
		long x = in.nextInt();
		long y = in.nextInt();

		if(y % x != 0) {
			System.out.println(0);
			return;
		}
		long z = y / x;
		long cnt = 0;
		for(long a = 1; a * a <= z; ++a) {
			if(z % a == 0) {
				long b = z / a;
				if(gcd(a, b) == 1) {
					long A = (long)a * x;
					long B = (long)b * x;
					if(l <= A && A <= r && l <= B && B <= r) {
						if(A == B)
							cnt++;
						else
							cnt += 2;
					}
				}
			}
		}
		System.out.println(cnt);

		out.close();
	}

	static long lcm(long a, long b) {
		return a * b / gcd(a, b);
	}

	static boolean nextPermutation(int[] a) {
		for(int i = a.length - 2; i >= 0; --i) {
			if(a[i] < a[i+1]) {
				for(int j = a.length - 1; ; --j) {
					if(a[i] < a[j]) {
						int t = a[i];
						a[i] = a[j];
						a[j] = t;
						for(i++, j = a.length - 1; i < j; ++i, --j) {
							t = a[i];
							a[i] = a[j];
							a[j] = t;
						}
						return true;
					}
				}
			}
		}
		return false;
	}

	static void shuffle(int[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			int t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static void shuffle(long[] a) {
		Random r = new Random();
		for(int i = a.length - 1; i > 0; --i) {
			int si = r.nextInt(i);
			long t = a[si];
			a[si] = a[i];
			a[i] = t;
		}
	}

	static int lower_bound(int[] a, int n, int k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}
	static int lower_bound(long[] a, int n, long k) {
		int s = 0;
		int e = n;
		int m;
		while (e - s > 0) {
			m = (s + e) / 2;
			if (a[m] < k)
				s = m + 1;
			else
				e = m;
		}
		return e;
	}

	static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	static class Pair implements Comparable<Pair> {
		int first, second;

		public Pair(int first, int second) {
			super();
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Pair o) {
			return this.first != o.first ? this.first - o.first : this.second - o.second;
		}

		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + first;
			result = prime * result + second;
			return result;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			Pair other = (Pair) obj;
			if (first != other.first)
				return false;
			if (second != other.second)
				return false;
			return true;
		}
	}

}

class InputReader {

	private final InputStream stream;
	private final byte[] buf = new byte[8192];
	private int curChar, snumChars;

	public InputReader(InputStream st) {
		this.stream = st;
	}

	public int read() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		return a;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public String nextLine() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private boolean isEndOfLine(int c) {
		return c == '\n' || c == '\r' || c == -1;
	}

}

/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class GFG {

	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		long l=sc.nextLong();
		long r=sc.nextLong();
		long gcd=sc.nextLong();
		long lcm=sc.nextLong();
		if(lcm%gcd!=0){
		    System.out.println("0");
		    return;
		}
		long x=lcm/gcd;
		long ans=0;
		int count=0;
		for(int i=1;i*i<=x;i++){
		    if(x%i==0){
		        long a =gcd*i;
		        long j=x/i;
		        long b=gcd*j;
		        if(gcd(i,j)==1 && a>=l && b <=r){
		            //count++;
		            if(a==b){
		                ans++;
		            }else{
		                ans=ans+2;
		            }
		        }
		    }
		}
		System.out.println(ans);
	}
	static long gcd(long a, long b){
	    if(b==0) return a;
	     else return gcd(b, a % b);

	}
}

import java.util.*;
import java.io.*;

   public class x992B
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int L = Integer.parseInt(st.nextToken());
         int R = Integer.parseInt(st.nextToken());
         int X = Integer.parseInt(st.nextToken());
         int Y = Integer.parseInt(st.nextToken());
         //
         if(Y%X != 0)
         {
            System.out.println(0);
            return;
         }
         int res = 0;
         int boof = Y/X;
         for(int i=1; i <= Math.sqrt(boof); i++)
         {
            if(boof%i == 0 && X*Math.min(i, boof/i) >= L && X*Math.max(i, boof/i) <= R)
               if(rp(i, boof/i))
               {
                  res += 2;
                  if(i == boof/i)
                     res--;
               }
         }
         System.out.println(res);
      }
      public static boolean rp(int a, int b)
      {
         if(b > a)
         {
            int t = a;
            a = b;
            b = t;
         }
         if(b == 0)
            return a == 1;
         return rp(b, a%b);
      }
   }

import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;

public class Main {
    private static FastReader sc = new FastReader(System.in);
    private static OutputWriter out = new OutputWriter(System.out);

    public static void main(String[] args) throws Exception {
        int l = sc.nextInt();
        int r = sc.nextInt();
        int gcd = sc.nextInt();
        int lcm = sc.nextInt();
        int x = lcm / gcd;
        if (lcm % gcd != 0) System.out.println(0);
        else System.out.println(ans(x, gcd, l, r));
    }

    private static int ans(int x, int gcd, int l, int r) {
        ArrayList<Integer> primes = sieve();
        HashMap<Integer, Integer> map = new HashMap<>();
        int n = x;
        for (int p : primes) {
            if (p > x) break;
            int cnt = 0;
            while (x % p == 0) {
                cnt++;
                x /= p;
            }
            if (cnt > 0) map.put(p, cnt);
        }
        if (x > 1) map.put(x, 1);
//        map.put(1, 1);
//        map.put(n, 1);
        int[][] arr = new int[map.size()][2];
        int idx = 0;
        for (int i : map.keySet()) {
            arr[idx][0] = i;
            arr[idx++][1] = map.get(i);
        }
//        System.out.println(map);

        int ans = 0;
        for (int i = 0; i < (1 << map.size()); i++) {
            int a = 1;
            for (int j = 0; j < map.size(); j++) {
                if ((i & (1 << j)) != 0) {
                    a *= pow(arr[j][0], arr[j][1]);
                }
            }
            int b = n / a;
            a *= gcd;
            b *= gcd;
            if (a >= l && a <= r && b <= r && b >= l) {
//                System.out.println(a + " " + b);
                ans++;
            }
        }

//        for (int k : map.keySet()) {
//            int a = pow(k, map.get(k));
//            int b = n / a;
//            a *= gcd;
//            b *= gcd;
//            if (a >= l && a <= r && b <= r && b >= l) {
//                System.out.println(a + " " + b);
//                ans++;
//            }
//        }
        return ans;
    }

    private static int pow(int a, int b) {
        int res = 1;
        while (b >= 1) {
            if (b % 2 == 1) res *= a;
            a *= a;
            b /= 2;
        }
        return res;
    }

    private static ArrayList<Integer> sieve() {
        ArrayList<Integer> primes = new ArrayList<>();
        boolean[] isComp = new boolean[(int) 1e6];
        for (int i = 2; i < 1e6; i++) {
            if (!isComp[i]) {
                primes.add(i);
                for (int j = 2 * i; j < 1e6; j += i) {
                    isComp[j] = true;
                }
            }
        }
        return primes;
    }
}

class FastReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public FastReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }

        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1) {
            return -1;
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar];
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == ',') {
                c = read();
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuilder buf = new StringBuilder();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r') {
                buf.appendCodePoint(c);
            }
            c = read();
        }
        return buf.toString();
    }

    public String nextLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String nextLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines) {
            return nextLine();
        } else {
            return readLine0();
        }
    }

    public BigInteger nextBigInteger() {
        try {
            return new BigInteger(nextString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char nextCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double nextDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E') {
                return res * Math.pow(10, nextInt());
            }
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return nextString();
    }

    public SpaceCharFilter getFilter() {
        return filter;
    }

    public void setFilter(SpaceCharFilter filter) {
        this.filter = filter;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

    public void flush() {
        writer.flush();
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt();
		int r=sc.nextInt();
		int g=sc.nextInt();
		int lc=sc.nextInt();
		//System.out.println(lc);
		ArrayList<Integer> a=new ArrayList<Integer> ();
		for (int i=1; i<=Math.sqrt(lc); i++)
        {
            if (lc%i==0)
            {
                if (lc/i == i&&i%g==0&&i>=l&&i<=r)
                    a.add(i);

                else if(lc/i != i)
                {
                		if(i%g==0&&i>=l&&i<=r)
                		a.add(i);
                		if((lc/i)%g==0&&(lc/i)>=l&&(lc/i)<=r)
                		a.add(lc/i);

                }
            }
        }
        //System.out.println(a);
        int c=0;
        for(int i=0;i<a.size();i++)
        {
        	for(int j=i+1;j<a.size();j++)
        	{
        		long gc=(long)gcd(a.get(i),a.get(j));
        		long lcm=(long)((a.get(i)/g)*a.get(j));
                	if(gc==(long)(g)&&lcm==(long)(lc))
                	{
                		++c;
                	}
        }
        }
        if(lc%g != 0)
		{
		System.out.println("0");
		}
        else if(a.size()==1)
        {
        	if(a.get(0)==lc&&1>=l)
        	{
        			System.out.println("1");
        	}
        	else if(g==lc&&a.get(0)==lc)
        		System.out.println("1");
        	else
        		System.out.println("0");
        }

        else
        System.out.println(c*2);
	}
	public static int gcd(int a,int b)
	{
		if (b == 0)
    		return a;
    	return gcd(b, a % b);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static ArrayList<Long> xx ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		long l = sc.nextLong() ;
		long r = sc.nextLong() ;
		long x = sc.nextLong() ;
		long y =sc.nextLong() ;

		if(x==y)
			if(x<=r && x>=l)
			{System.out.println(1);return ; }
			else
			{System.out.println(0);return ; }

		//// 10000000000000000l
		if(1l*x*y >= 1000000000000000l)
		{
			long c= 0 ;
			int limit = (int) Math.ceil(y/x);
			//	System.err.println(limit);
			for (int i = 1; i <= limit; i++)
				for (int j = 1; j <=limit; j++)
				{
					long a = 1l*i*x ;
					long b = 1l*j*x ;

					if(a>=Math.max(l, x) && a<=Math.min(r,y) && b>=Math.max(l, x) && b<=Math.min(r,y))
					{
						if((gcdThing(a, b)==x && (1l*a*b==1l*x*y)))c++;
					}

				}
			System.out.println(c); return ;
		}
		ArrayList<Long> arr = new ArrayList<Long>() ;
		arr = divisors(1l*x*y) ;
		Collections.sort(arr);

		long n = arr.size() ;
		long c=0 ;
		for (int i =(int) n/2; i <n; i++)
		{
			long a = arr.get(i);
			long b = arr.get((int)n-1-i);

			if(a>=Math.max(l, x) && a<=Math.min(r,y) && b>=Math.max(l, x) && b<=Math.min(r,y))
			{
				if(gcdThing(a, b)==x)if(a==b)c++; else c+=2;
				//	if(gcdThing(a,b)==x)System.err.println(a+" "+b);
			}
			else
				break ;

		}
		System.out.println(c);
		//    2672374
		///2672374 422235092 1336187 844470184
		///                   105558773
		///                   10689496

	}

	// method to print the divisors
	static ArrayList<Long> divisors(long n)
	{
		ArrayList<Long> arr =  new ArrayList<Long>() ;
		// Note that this loop runs till square root
		for (int i=1; i<=Math.sqrt(n); i++)
		{
			if (n%i==0)

				// If divisors are equal, print only one
				if (n/i == i)
				{arr.add(1l*i);arr.add(1l*i);}

				else // Otherwise print both
				{arr.add(1l*i); arr.add(1l*n/i);}

		}

		return arr ;

	}

	public static void generate(long current)
	{
		if(current>10000000000l)
			return ;

		xx.add(current) ;
		generate((10*current) +4);
		generate((10*current) +7);

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}
	public static class point implements  Comparable<point>
	{
		int x, y ;
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members
			point c = (point) o;

			// Compare the data members and return accordingly
			return Integer.compare(x, c.x) == 0
					&& Integer.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ;
			else
				return -1 ;
		}

		@Override
		public int hashCode()
		{
			return 15+x+(y%2) ;
		}

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vaibhav Pulastya
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BNastyaStudiesInformatics solver = new BNastyaStudiesInformatics();
        solver.solve(1, in, out);
        out.close();
    }

    static class BNastyaStudiesInformatics {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();
            int count = 0;
            ArrayList<Long> div = new ArrayList<>();
            for (long i = 1; i * i <= y; i++) {
                if (y % i == 0) {
                    long j = y / i;
                    div.add(i);
                    if (i != j) div.add(j);
                }
            }

            for (int i = 0; i < div.size(); i++) {
                long a = div.get(i);
                long b = (x * y) / a;
                if (gcd(a, b) != x) continue;
                if (a >= l && a <= r && b >= l && b <= r) {
                    count++;
                }
            }

            out.println(count);
        }

        long gcd(long a, long b) {
            if (a < b) return gcd(b, a);
            if (b == 0) return a;
            return gcd(b, a % b);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.*;
import java.util.*;

public class Solution {
 static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
		FastReader sc=new FastReader();
		StringBuilder sb=new StringBuilder();
		int l=sc.nextInt();
		int r=sc.nextInt();
		int x=sc.nextInt();
		int y=sc.nextInt();

		HashSet<Integer> set=new HashSet<Integer>();
		for(int i=1;i*i<=y;i++){
			if(y%i==0){
				set.add(i);

				set.add(y/i);
			}
		}
		int c=0;
		for(int a:set){
			long b=x;
			b*=y;
			b/=a;

			if(a<=r&&a>=l&&b<=r&&b>=l){
			int temp=gcd(a,(int)b);
			if(temp==x)
				c++;
			}
		}

		sb.append(c+" ");
		System.out.println(sb);
    }
	static int gcd(int a,int b){
		if(a==0)
			return b;
		return gcd(b%a,a);
	}
}

import java.util.*;

public class problem5 {
    public static int gcd(int a, int b) {
        while (b > 0) {
            int t = a % b;
            a = b;
            b = t;
        }
        return a;
    }
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int l = scan.nextInt();
        int r = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        if (y % x != 0){
            System.out.println(0);
        }
        else {
            int ans = 0;
            int n = y / x;
            for (int d = 1; d * d <= n; ++d) {
                if (n % d == 0) {
                    int c = n / d;
                    if (l <= c * x && c * x <= r && l <= d * x && d * x <= r && gcd(c, d) == 1) {
                        if (d * d == n) ++ans;
                        else ans += 2;
                    }
                }
            }
            System.out.println(ans);
        }
    }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code2
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		long l = in.nextLong();
		long r = in.nextLong();
		long x = in.nextLong();
		long y = in.nextLong();

		y/=x;
		HashSet<Long> set = new HashSet<>();
		long ans = 1;
		while(x!=1 && y%x==0)
		{
			y/=x;
			ans*=x;
		}
		if(ans!=1L)
			set.add(ans);

		for(int i=2;(long)i*(long)i<=y;i++)
		{
			ans = 1;
			while(y%i==0)
			{
				y/=i;
				ans*=i;
			}
			if(ans!=1L)
				set.add(ans);
		}
		set.add(y);
		long mul = 1;
		for(long p : set)
			mul*=p;

		HashSet<pair> answer = new HashSet<>();
		ans = 1;
		for(long p : set)
		{
			ans*=p;
			long one = x*ans;
			long two = (mul*x)/ans;
			if(one>=l && one<=r && two>=l && two<=r)
				answer.add(new pair(one,two));
		}
		//System.out.println(answer.toString());
		int count = 0;
		for(pair p : answer)
		{
			if(p.x!=p.y)
				count++;
			count++;
		}

		pw.println(count);
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int 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;
	}

	static class pair implements Comparable<pair>
	{
		Long x, y;
		pair(long x,long y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

//package codeforces.Round489;

import java.util.Scanner;

public class NastyaStudiesInformatics {

    private static long x;
    private static long y;

    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    private static long lcm(long a, long b) {
        return (a*b) / gcd(a, b);
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        long l = s.nextLong();
        long r = s.nextLong();
        x = s.nextLong();
        y = s.nextLong();

        long res = 0;
        long c = y / x;
        if (y % x == 0) {
            for (int i = 1; i <= Math.sqrt(y / x); i++) {
                long z = c / i;
                if (i >= l && z <= r && c % i == 0 && gcd(i, z) == 1) {
                    if (z == i) res++;
                    else res += 2;
                }
            }
        }

        System.out.println(res);

    }
}

//package jan2020;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class A992 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		long l = scn.nextLong();
		long r = scn.nextLong();
		long hcf = scn.nextLong();
		long lcm = scn.nextLong();
		ArrayList<Long> factors = new ArrayList<>();
		for (long i = 1; i * i <= lcm; i++) {
			if (lcm % i == 0) {
				factors.add(i);
				if (i != (lcm / i)) {
					factors.add(lcm / i);
				}
			}
		}
		long pairs = 0;
		for (int i = 0; i < factors.size(); i++) {
			long curr = factors.get(i);
			for (int j = 0; j < factors.size(); j++) {
				if (j != i) {
					long gcd1 = gcd(curr, factors.get(j));
					long lcm1 = (curr * factors.get(j)) / gcd1;
					if (gcd1 == hcf && lcm1 == lcm) {
						if (gcd1 >= l && gcd1 <= r) {
							if (lcm1 >= l && lcm1 <= r) {
								if (gcd1 != lcm1) {
									pairs++;
								}
							}
						}
					}
				}

			}
		}
		out.println(pairs);
		out.close();

	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;

		return gcd(b % a, a);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

import java.io.*;
import java.util.*;

public	 class template
	{
		private InputStream is;
		private PrintWriter pw;
		static char[][] ch;
		static int  x1,x2,y1,y2,n,m,h,k;
		static long dist[][];
		static boolean boo[][];

		void soln()
		{
			is = System.in;
			pw = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			pw.close();
			pw.flush();
			// tr(System.currentTimeMillis() - s + "ms");
		}

		public static void main(String[] args) throws Exception
		{
			new Thread(null, new Runnable()
			{
				public void run()
				{
					try
					{
						// new CODEFORCES().soln();
					} catch (Exception e)
					{
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();
			new template().soln();
		}

		void solve()
		{
			long l = ni(), r = ni(), x = ni(), y = ni();
			long mul = x*y;
			int cnt = 0;
			if(x==y && x>=l && x<=r) {pw.println(1);return;}
			long temp = Math.max(l,mul/r);
			temp += (temp % x);
			for(long i = temp; i*i<=mul && i<= Math.min(r,mul/l);i+=x){
				//pw.println(i);
				if(mul%i==0 && gcd(i,mul/i)==x){
					//pw.println(i);
					if(mul/i != i) cnt+=2;
					else cnt++;
				}
			}
			pw.println(cnt);
			pw.close();
		}
		long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}
		void printArray(long[] arr) {
			for(long i : arr) pw.print(i +" ");
			pw.println();
		}
	static long min(long x, long y){
		return (x<y)?x:y;
	}
	static class Pair implements Comparable<Pair>{
		long val;
		int  x, y;
		Pair(long v, int a, int b){
			val = v; x = a; y = b;
		}
		public int compareTo(Pair p){
			return Long.compare(this.val,p.val);
		}
	}
	private static class Queue{
		int st = 0;
		int et = 0;
		Pair[] arr;
		public Queue(int len) {
			arr = new Pair[len];
		}
		public boolean isEmpty() {
			return st==et;
		}
		public void add(Pair x) {
			arr[et++] = x;
		}
		public Pair poll() {
			return arr[st++];
		}
		public void clear() {
			st = et = 0;
		}
	}
		/*void bfs(int k) {
			while(!q.isEmpty()) {
				int y = q.poll();
				for(long i : amp[y]) {
					if(!b[i]) {
						D[i][k] = D[y][k]+1;
						q.add(i);
						b[i] = true;
					}
				}
			}
		}
		*/
		/*
		int dfs(int x) {
			b[x] = true;
			//start[x] = time++;
			int ans = 1;
			for(int i : amp[x]) {
				if(!b[i]) {
					ans += dfs(i);
				}
			}
			//end[x] = time;
			if(x!= 0 && ans%2==0 && (N-ans)%2==0) cost++;

			return ans;
		}*/

		/*void buildGraph(int n)
		{
			for (int i = 0; i < n; i++)
			{
				int x1 = ni() - 1, y1 = ni() - 1;
				amp[x1].add(y1);
				amp[y1].add(x1);
			}
		}*/
		public static int[] shuffle(int[] a, Random gen)
		{
			for (int i = 0, n = a.length; i < n; i++)
			{
				int ind = gen.nextInt(n - i) + i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
			return a;
		}
		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte()
		{
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf)
			{
				ptrbuf = 0;
				try
				{
					lenbuf = is.read(inbuf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c)
		{
			return !(c >= 33 && c <= 126);
		}

		private int skip()
		{
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd()
		{
			return Double.parseDouble(ns());
		}

		private char nc()
		{
			return (char) skip();
		}

		private String ns()
		{
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b)))
			{ // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n)
		{
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b)))
			{
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m)
		{
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n)
		{
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private int ni()
		{
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl()
		{
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o)
		{
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}

import java.util.*;
import java.io.*;
import java.math.*;

public class MainClass
{
	public static long hits=0;

	public static void main(String[] args)  throws IOException
	{
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long l=in.nextLong();
		long r=in.nextLong();
		long x=in.nextLong();
		long y=in.nextLong();

		long ans=0;

		long n=x*y;
		long rt=(long) Math.sqrt(n);
		for(long i=Math.max(l, x);i<=Math.min(r, rt);i++)
		{
			if(n%i==0)
			{
				if(n/i==i && x==1L)
				{
					ans++;
				}
				else if(gcd(i,n/i)==x)
				{
					ans+=2;
				}
			}
		}
			out.println(ans);

			out.flush();
		out.close();
	}

	public static long gcd(long a, long b)
	{
		if(a==0)
			return b;
		if(a>b)return gcd(a%b,b);

		return gcd(b%a, a);
	}

}
class InputReader{
    private final InputStream stream;
    private final byte[] buf=new byte[1024];
    private int curChar;
    private int numChars;
    public InputReader(InputStream stream){this.stream=stream;}
    public int read()throws IOException{
        if(curChar>=numChars){
            curChar=0;
            numChars=stream.read(buf);
            if(numChars<=0)
                return -1;
        }
        return buf[curChar++];
    }
    public final int nextInt()throws IOException{return (int)nextLong();}
    public final long nextLong()throws IOException{
        int c=read();
        while(isSpaceChar(c)){
            c=read();
            if(c==-1) throw new IOException();
        }
        boolean negative=false;
        if(c=='-'){
            negative=true;
            c=read();
        }
        long res=0;
        do{
            if(c<'0'||c>'9')throw new InputMismatchException();
            res*=10;
            res+=(c-'0');
            c=read();
        }while(!isSpaceChar(c));
        return negative?(-res):(res);
    }
    public final int[] readIntBrray(int size)throws IOException{
        int[] arr=new int[size];
        for(int i=0;i<size;i++)arr[i]=nextInt();
        return arr;
    }
    public final String next()throws IOException{
        int c=read();
        while(isSpaceChar(c))c=read();
        StringBuilder res=new StringBuilder();
        do{
            res.append((char)c);
            c=read();
        }while(!isSpaceChar(c));
        return res.toString();
    }
    public final String nextLine()throws IOException{
        int c=read();
        while(isSpaceChar(c))c=read();
        StringBuilder res=new StringBuilder();
        do{
            res.append((char)c);
            c=read();
        }while(c!='\n'&&c!=-1);
        return res.toString();
    }
    private boolean isSpaceChar(int c){
        return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
    }

}

//package com.prituladima.codeforce;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

import static java.lang.Math.min;
import static java.lang.Math.sqrt;

/**
 * Created by prituladima on 6/18/18.
 */
public class C992B {

    private void solve() throws IOException {

        int l = nextInt(), r = nextInt(), x = nextInt(), y = nextInt();

        int mul = x * y;

        int c = 0;
        boolean eq = false;
        for (int i = l; i <= min(r, (int)sqrt(mul)); i++) {

            if (mul % i != 0) continue;
            int part = mul / i;
            if (l <= part && part <= r && gcd(part, i) == x && lcm(part, i) == y) {
                if (i != part) {
                    c++;
                } else {
                    eq = true;
                }
            }

        }

        System.out.println(2 * c + ((eq) ? 1 : 0));

    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    public static void main(String[] args) {
        new C992B().run();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.awt.image.VolatileImage;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class Main {
    private static Scanner sc;
    private static Printer pr;
    static boolean []visited;
    static int []color;
    static int []pow=new int[(int)3e5+1];
    static int []count;
    static boolean check=true;
    static boolean checkBip=true;
    static ArrayList<Integer>[]list;
    private static long aLong=(long)(Math.pow(10,9)+7);
    static final long div=998244353;
    static  int answer=0;
    static int[]countSubTree;
    static int[]colorNode;
    private static void solve() throws IOException {
        long l=sc.nextLong(),r=sc.nextLong(),x=sc.nextLong(),y=sc.nextLong(),count=0;
        if (y%x!=0){
            System.out.println(0);
            System.exit(0);
        }
        long div=y/x;
        if (div==1){
            System.out.println(1);
            System.exit(0);
        }
        for (long i=1;i*i<=div;i++){
            if (div%i==0){
                if ((i==div/i)&&(i>=l/x&&i<=r/x)&&(div/i>=l/x&&div/i<=r/x)&&(i==x&&i==y)) ++count;
                else {
                    if ((i>=l/x&&i<=r/x)&&((div/i)>=(l/x)&&(div/i)<=(r/x))&&gcd(i,div/i)==1) count+=2;
                    else continue;
                }
            }
        }
        pr.println(count);

    }
    public static class Task{
        int lab;
        int ind;
        public Task(int  lab,int ind) {
            this.lab = lab;
            this.ind=ind;
        }
    }
    public static void printSolve(StringBuilder str, int[] colors, int n,int color){
        for(int i = 1;i<=n;++i)
            if(colors[i] == color)
                str.append(i + " ");
        str.append('\n');
    }
    public static class pairTask{
        int  val;
        int size;
        public pairTask(int   x, int  y) {
            this.val = x;
            this.size = y;
        }
    }
    public static void subTree(int src,int parent){
        countSubTree[src]=1;
        for (int v:list[src]){
            if (v==parent)
                continue;
            subTree(v,src);
            countSubTree[src]+=countSubTree[v];
        }
    }
    public static boolean prime(long src){
        for (int i=2;i*i<=src;i++){
            if (src%i==0)
                return false;
        }
        return true;
    }
    public static void bfsColor(int src){
        Queue<Integer>queue = new ArrayDeque<>();
        queue.add(src);
        while (!queue.isEmpty()){
            boolean b=false;
            int vertex=-1,p=-1;
            int poll=queue.remove();
            for (int v:list[poll]){
                if (color [v]==0){
                    vertex=v;
                    break;
                }
            }
            for (int v:list[poll]){
                if (color [v]!=0&&v!=vertex){
                    p=v;
                    break;
                }
            }
            for (int v:list[p]){
                if (color [v]!=0){
                    color[vertex]=color[v];
                    b=true;
                    break;
                }
            }
            if (!b){
                color[vertex]=color[poll]+1;
            }
        }
    }
    static int add(int a,int b ){
        if (a+b>=div)
            return (int)(a+b-div);
        return (int)a+b;
    }
    public static int isBipartite(ArrayList<Integer>[]list,int src){
        color[src]=0;
        Queue<Integer>queue=new LinkedList<>();
        int []ans={0,0};
        queue.add(src);
        while (!queue.isEmpty()){
            ans[color[src=queue.poll()]]++;
            for (int v:list[src]){
                if (color[v]==-1){
                    queue.add(v);
                    color[v]=color[src]^1;
                }else if (color[v]==color[src])
                    check=false;
            }
        }
        return add(pow[ans[0]],pow[ans[1]]);
    }
    public static int powerMod(long b, long e){
        long ans=1;
        while (e-->0){
            ans=ans*b%div;
        }
        return (int)ans;
    }
    public static int dfs(int s){
        int ans=1;
        visited[s]=true;
        for (int k:list[s]){
            if (!visited[k]){
                ans+=dfs(k);
            }
        }
        return ans;
    }
    public static int[] radixSort(int[] f) {
        int[] to = new int[f.length];
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] & 0xffff)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] & 0xffff]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        {
            int[] b = new int[65537];
            for (int i = 0; i < f.length; i++) b[1 + (f[i] >>> 16)]++;
            for (int i = 1; i <= 65536; i++) b[i] += b[i - 1];
            for (int i = 0; i < f.length; i++) to[b[f[i] >>> 16]++] = f[i];
            int[] d = f;
            f = to;
            to = d;
        }
        return f;
    }
    public static long []primeFactor(int n){
        long []prime=new long[n+1];
        prime[1]=1;
        for (int i=2;i<=n;i++)
            prime[i]=((i&1)==0)?2:i;
        for (int i=3;i*i<=n;i++){
            if (prime[i]==i){
                for (int j=i*i;j<=n;j+=i){
                    if (prime[j]==j)
                        prime[j]=i;
                }
            }
        }
        return prime;
    }
    public static StringBuilder binaryradix(long number){
        StringBuilder builder=new StringBuilder();
        long remainder;
        while (number!=0) {
            remainder = number % 2;
            number >>= 1;
            builder.append(remainder);
        }
        builder.reverse();
        return builder;
    }
    public static int binarySearch(long[] a, int index,long target) {
            int l = index;
            int h = a.length - 1;
            while (l<=h) {
                int med = l + (h-l)/2;
                if(a[med] - target <= target) {
                    l = med + 1;
                }
                else h = med  - 1;
            }
            return h;
    }
    public static int val(char c){
        return c-'0';
    }
    public static long gcd(long a,long b) {
        if (a == 0) return b;
        return gcd(b % a, a);
    }
        private static class Pair implements Comparable<Pair> {
            long x;
            long y;

            Pair() {
                this.x = 0;
                this.y = 0;
            }

            Pair(long x, long y) {
                this.x = x;
                this.y = y;
            }

            @Override
            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj == null) return false;
                Pair other = (Pair) obj;
                if (this.x == other.x && this.y == other.y) {
                    return true;
                }
                return false;
            }

            @Override
            public int compareTo(Pair other) {
                if (this.x != other.x) return Long.compare(this.x, other.x);
                return Long.compare(this.y*other.x, this.x*other.y);
            }
    }

    public static void main(String[] args) throws IOException {
        sc = new Scanner(System.in);
        pr = new Printer(System.out);
        solve();

        pr.close();
       // sc.close();
    }
    private static class Scanner {
        BufferedReader br;

        Scanner (InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

        private boolean isPrintable(int ch) {
            return ch >= '!' && ch <= '~';
        }

        private boolean isCRLF(int ch) {
            return ch == '\n' || ch == '\r' || ch == -1;
        }

        private int nextPrintable() {
            try {
                int ch;
                while (!isPrintable(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }

                return ch;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        String next() {
            try {
                int ch = nextPrintable();
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (isPrintable(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        int nextInt() {
            try {
                // parseInt from Integer.parseInt()
                boolean negative = false;
                int res = 0;
                int limit = -Integer.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Integer.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                int multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        long nextLong() {
            try {
                // parseLong from Long.parseLong()
                boolean negative = false;
                long res = 0;
                long limit = -Long.MAX_VALUE;
                int radix = 10;

                int fc = nextPrintable();
                if (fc < '0') {
                    if (fc == '-') {
                        negative = true;
                        limit = Long.MIN_VALUE;
                    } else if (fc != '+') {
                        throw new NumberFormatException();
                    }
                    fc = br.read();
                }
                long multmin = limit / radix;

                int ch = fc;
                do {
                    int digit = ch - '0';
                    if (digit < 0 || digit >= radix) {
                        throw new NumberFormatException();
                    }
                    if (res < multmin) {
                        throw new NumberFormatException();
                    }
                    res *= radix;
                    if (res < limit + digit) {
                        throw new NumberFormatException();
                    }
                    res -= digit;

                } while (isPrintable(ch = br.read()));

                return negative ? res : -res;
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        float nextFloat() {
            return Float.parseFloat(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                int ch;
                while (isCRLF(ch = br.read())) {
                    if (ch == -1) {
                        throw new NoSuchElementException();
                    }
                }
                StringBuilder sb = new StringBuilder();
                do {
                    sb.appendCodePoint(ch);
                } while (!isCRLF(ch = br.read()));

                return sb.toString();
            } catch (IOException e) {
                throw new NoSuchElementException();
            }
        }

        void close() {
            try {
                br.close();
            } catch (IOException e) {
//				throw new NoSuchElementException();
            }
        }
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }

    static class List {
        String Word;
        int length;

        List(String Word, int length) {
            this.Word = Word;
            this.length = length;
        }
    }
    private static class Printer extends PrintWriter {
        Printer(PrintStream out) {
            super(out);
        }
    }
}

import java.awt.*;
import java.io.*;
import java.util.*;

public class Abc {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int l=sc.nextInt(),r=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
        if (y%x!=0){
            System.out.println(0);
            return;
        }
        int tmp=y/x;
        int ans=0;
        for (int i=1;i*i<=tmp;i++){
            if (tmp%i==0){
                int c=i,d=tmp/i;
                long a=(long) c*x,b=(long)d*x;
                if (a==b)continue;
                if (a>=l && a<=r && b>=l && b<=r && gcd(a,b)==x && a*b/gcd(a,b)==y)ans+=2;

            }
        }
        System.out.println(ans);
    }
    static long gcd(long a,long b){
        if (a==0)return b;
        return gcd(b%a,a);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.util.*;
public class NastyaStudiesInformatics {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		if(x==y)
		{
			System.out.println("1");
			return;
		}

		long mult = x * y;
		long count = 0;
		long i;
		if(l>x)
			i = l;
		else
			i = x;
		long s = (long)Math.sqrt(mult);
		for(;i<=s && i<=r;i+=x)
		{
			if((mult%i)==0)
			{
				long p = (mult/i);
				if(p>=l && p<=r)
				{
					long g = gcd(i,p);
					if(g==x)
					count += 2;
				}
			}
		}

		System.out.println(count);
	}

	public static long gcd(long A,long B)
	{
		if(B==0)	return A;

		return gcd(B,A%B);
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rishabhdeep Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        List<Integer> divisors(int n) {
            List<Integer> set = new ArrayList<>();
            for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
                if (n % i == 0) {
                    if ((n / i) == i)
                        set.add(i);
                    else
                        set.add(n / i);
                }
            }
            return set;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int l = in.nextInt(), r = in.nextInt(), gcd = in.nextInt(), lcm = in.nextInt();
            List<Integer> list = divisors(lcm);
            Set<TaskB.Pair<Integer, Integer>> set = new HashSet<>();
            for (int i = 0; i < list.size(); i++) {
                int a = lcm / list.get(i);
                int b = gcd * list.get(i);
                long GCD = Utilities.gcd(a, b);
//            out.println("A = " + a + " B = " + b + " GCD = " + GCD);
                if (GCD == gcd && a * b == lcm * GCD)
                    if (l <= a && a <= r && l <= b && b <= r) {
                        TaskB.Pair<Integer, Integer> p = new TaskB.Pair<>(a, b);
                        TaskB.Pair<Integer, Integer> q = new TaskB.Pair<>(b, a);
                        set.add(p);
                        if (a != b)
                            set.add(q);
                    }
            }
            out.println(set.size());
        }

        public static class Pair<first, second> {
            public first First;
            public second Second;

            public Pair(first First, second Second) {
                this.First = First;
                this.Second = Second;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class Utilities {
        public static long gcd(long a, long b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

    }
}

/**
 * Date: 18 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Set;

public class newProgram1 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int l = in.ni();
        int r = in.ni();
        long x = in.ni();
        long y = in.ni();
        Set<Long> ss = new HashSet<>();
        for (long i = 1; i * i <= y; i++) {
            if (y % i == 0) {
//                System.out.println(i);
                ss.add(i);
                ss.add(y / i);
            }
        }
        GCD gcd = new GCD();
        int count = 0;
        y = y * x;
        for (long i : ss) {
            if (gcd.calc_gcd(i, y / i) == x) {
                System.out.println(i + " " + gcd.calc_gcd(i, y / i));
                if (l <= i && i <= r && l <= y / i && y / i <= r) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class GCD {

    public GCD() {
        // Sry Nothing to initalise
    }

    public long a_inv_b(long a, long m) {
        if (gcd(a, m) == 1) {
            long m0 = m;
            long y = 0, x = 1;
            if (m == 1) {
                return 0;
            }
            while (a > 1) {
                long q = a / m;
                long t = m;
                m = a % m;
                a = t;
                t = y;
                y = x - q * y;
                x = t;
            }
            if (x < 0) {
                x += m0;
            }
            return x;
        } else {
            return -1;
        }
    }

    public int calc_gcd(int a, int b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return (int) gcd(a, b);
    }

    public long calc_gcd(long a, long b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return gcd(a, b);
    }

    private long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        long gcd = gcd(b, a % b);
        return gcd;
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakhar897
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long b, a, j;
            long count = 0, i;

            if (x > r || y % x != 0) {
                out.println(0);
                return;
            }

            if (x == y && x <= r) {
                out.println(1);
                return;
            }

            y /= x;

            for (i = l; i * i <= y; i++) {
                if (y % i == 0) {
                    a = x * i;
                    j = y / i;
                    b = x * j;
                    if (b >= l && b <= r && a >= l && a <= r) {
                        if (gcd(a, b) == x) {
                            count += 2;
                            if (i == b)
                                --count;
                        }
                    }
                }
            }

            out.println(count);

        }

        public long gcd(long a, long b) {
            return (a % b == 0 ? b : gcd(b, a % b));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class A {
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        long l = Reader.nextInt();
        long r = Reader.nextInt();
        long x = Reader.nextInt();
        long y = Reader.nextInt();
        long iii = x*y;
        long te = (long)Math.sqrt(iii);
        long count = 0;
        long L = (l + x -1)/x;
        long R = te/x;
        for(long i = L; i <= R; i++){
            if(y%i == 0 && gcd(i ,iii/(i) ) == 1){count++;}
        }

        if(te*te == iii && te == x) System.out.println(Math.max(count*2 - 1, 0));
        else  System.out.println(count*2);

    }

    static long gcd(long a, long b){
        if(a == 0){return b;}
        return gcd(b%a, a);
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");

    }

    static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            tokenizer = new StringTokenizer(

                    reader.readLine() );

        }
        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() {

        return Long.parseLong(nextToken());
    }
}

/**
 * Date: 18 Jun, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashSet;
import java.util.Set;

public class newProgram1 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int l = in.ni();
        int r = in.ni();
        long x = in.ni();
        long y = in.ni();
        Set<Long> ss = new HashSet<>();
        for (long i = 1; i * i <= y; i++) {
            if (y % i == 0) {
//                System.out.println(i);
                ss.add(i);
            }
        }
        GCD gcd = new GCD();
        int count = 0;
        y = y * x;
        for (long i : ss) {
//            System.out.println(i + " " + gcd.calc_gcd(i, y / i));
            if (gcd.calc_gcd(i, y / i) == x) {
                if (l <= i && i <= r && l <= (y / i) && (y / i) <= r) {
                    count += 2;
                }
                if (i == y / i) {
                    count--;
                }
            }
        }
        System.out.println(count);
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
            bw.flush();
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
            bw.flush();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}

class GCD {

    public GCD() {
        // Sry Nothing to initalise
    }

    public long a_inv_b(long a, long m) {
        if (gcd(a, m) == 1) {
            long m0 = m;
            long y = 0, x = 1;
            if (m == 1) {
                return 0;
            }
            while (a > 1) {
                long q = a / m;
                long t = m;
                m = a % m;
                a = t;
                t = y;
                y = x - q * y;
                x = t;
            }
            if (x < 0) {
                x += m0;
            }
            return x;
        } else {
            return -1;
        }
    }

    public int calc_gcd(int a, int b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return (int) gcd(a, b);
    }

    public long calc_gcd(long a, long b) {
        if (b > a) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        return gcd(a, b);
    }

    private long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        long gcd = gcd(b, a % b);
        return gcd;
    }
}

import java.util.*;
public class prob1
{
	public static int gcd(int a,int b){
		while(b!=0){
			int p = a%b;
			a=b;
			b=p;
		}
		return a;
	}

	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner scan = new Scanner(System.in);
		int l = scan.nextInt();
		int r = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		y = y/x;
		int v =0;
		for(int i=1;i<=Math.sqrt(y);i++){
			int p=y/i;
			if(y%i==0&&gcd(p,i)==1&&i>=l&&i<=r&&p>=l&&p<=r){
				if(p!=i){
					v=v+2;
				}
				else{
					v++;
				}
			}
		}
		System.out.println(v);
	}
}

import java.io.*;
import java.util.*;

public class Solution {
 static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
		FastReader sc=new FastReader();
		StringBuilder sb=new StringBuilder();
		int l=sc.nextInt();
		int r=sc.nextInt();
		int x=sc.nextInt();
		int y=sc.nextInt();
		int t=gcd(x,y);
		y/=t;
		x/=t;
		HashSet<Integer> set=new HashSet<Integer>();
		for(int i=1;i*i<=y;i++){
			if(y%i==0){
				set.add(i);

				set.add(y/i);
			}
		}
		int c=0;
		for(int a:set){
			int b=y/a;
//			System.out.println(a+" "+b+" "+(a/gcd(a,b)*b));
			if(a<=r&&a>=l&&b<=r&&b>=l){
			int temp=gcd(a,b);
			long yo=a;
			yo*=b;
			long ans=temp;
			ans*=y;
			if(temp==x&&ans==yo)
				c++;
			}
		}

		sb.append(c+" ");
		System.out.println(sb);
    }
	static int gcd(int a,int b){
		if(a==0)
			return b;
		return gcd(b%a,a);
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;

public class firstone {

    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        NumberFormat formatter = new DecimalFormat("#0.000000000000");

        long l = in.nextLong();
        long r = in.nextLong();
        long G = in.nextLong();
        long L = in.nextLong();
        if(l>L)
        {
            out.print("0");
            out.close();
            return;
        }
        if(L%G!=0)
        {
            out.print("0");
            out.close();
            return;
        }
        long div = L/G;
        HashSet<Long> hs = new HashSet<>();

        if(div % 2 ==0)
        {
            hs.add(2L);
            while (div % 2 == 0)
            {
                div/=2L;
            }
        }
        for (int i = 3 ; i*i <=div ; i++)
        {
            if(div % i == 0)
            {
                hs.add((long) i);
                while (div % i == 0)
                {
                    div/=i;
                }
            }
        }
        if(div>2)
        {
            hs.add(div);
        }
        Iterator<Long> itr = hs.iterator();
        long cout = 0;
        while (itr.hasNext())
        {
            long k = itr.next();
            if(k>=l && k<=r)
            {
                cout++;
            }
        }
        out.print((int) Math.pow(2,cout));
        out.close();

    }

    static public final class Pair<A, B> {
        private final A a;
        private final B b;

        private Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        /**
         * Returns a pair whose elements are the first and second
         * arguments, respectively.
         * @return a pair constructed from the arguments
         */
        public static <C, D> Pair<C, D> valueOf(C c, D d) {
            // Don't mandate new values.
            return new Pair<C, D>(c, d);
        }

        /**
         * Returns the value of the first element of the pair.
         * @return the value of the first element of the pair
         */
        public A getA() {
            return a;
        }

        /**
         * Returns the value of the second element of the pair.
         * @return the value of the second element of the pair
         */
        public B getB() {
            return b;
        }

        /**
         * TBD
         */
        @Override
        public String toString() {
            return "[" + Objects.toString(a) + ", " + Objects.toString(b) + "]";
        }

        /**
         * TBD
         */
        @Override
        public boolean equals(Object x) {
            if (!(x instanceof Pair))
                return false;
            else {
                Pair<?,?> that = (Pair<?,?>) x;
                return
                        Objects.equals(this.a, that.a) &&
                                Objects.equals(this.b, that.b);
            }
        }

        /**
         * TBD
         */
        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class prog_A {
	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int l = in.nextInt();
		int r = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int ans = 0;
		if (y % x == 0) {
			y /= x;
			for (int i = 1; i * i <= y; i++) {
				if (y % i == 0) {
					int a = i;
					int b = y / i;
					if (gcd(a, b) == 1) {
						if (l <= Math.min(a, b) * x && Math.max(a, b) * x <= r)
							ans += 2;
						if (a == b)
							ans--;
					}
				}
			}
		}
		out.println(ans);
		in.close();
		out.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakhar897
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long mul = x * y;

            long b, m, n;
            long count = 0, i;

            if (x > r || y % x != 0) {
                out.println(0);
                return;
            }

            y /= x;

            for (i = l; i * i <= y; i++) {
                if (mul % i == 0) {
                    b = mul / i;
                    //a,b == i,b
                    if (b >= l && b <= r && i >= l && i <= r) {
                        if (gcd(i, b) == x) {
                            n = i / x;
                            m = b / x;
                            if (n * m == y) {
                                count += 2;
                                if (i == b)
                                    --count;
                            }
                        }
                    }
                }
            }

            out.println(count);

        }

        public long gcd(long a, long b) {
            return (a % b == 0 ? b : gcd(b, a % b));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CS_81_D {
	public static long gcd(long a, long b) {
		return a == 0 ? b : gcd(b % a, a);
	}

	static int l;
	static int r;

	public static boolean in(int x) {
		return x >= l && x <= r;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		l = sc.nextInt();
		r = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int tot = 0;
		if (y % x != 0)
			System.out.println(0);
		if (y == x)
			System.out.println(in(x) ? 1 : 0);
		else {
			int z = y / x;
			for (int i = 1; 1l * i * i <= z; i++) {
				if (z % i == 0) {
					if (gcd(i, z / i) == 1 && in(x * i) && in((z / i) * x)) {
						tot += 2;
					}

				}
			}
			System.out.println(tot);
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class CS_81_D {
	public static long gcd(long a, long b) {
		return a == 0 ? b : gcd(b % a, a);
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		long x = sc.nextInt();
		long y = sc.nextInt();
		long tot = 0;
		for (long i = l; i * i <= y && i <= r; i++) {
			if (y % i == 0) {
				long j = (y / i) * x;
				if (gcd(i, j) == x && j <= r && j >= l) {
					tot++;
					if (i != j)
						tot++;
				}
			}
		}
		System.out.println(tot);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String f) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(f));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] nextIntArray1(int n) throws IOException {
			int[] a = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public int[] shuffle(int[] a, int n) {
			int[] b = new int[n];
			for (int i = 0; i < n; i++)
				b[i] = a[i];
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				int t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
			return b;
		}

		public int[] nextIntArraySorted(int n) throws IOException {
			int[] a = nextIntArray(n);
			a = shuffle(a, n);
			Arrays.sort(a);
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArray1(int n) throws IOException {
			long[] a = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}

		public long[] nextLongArraySorted(int n) throws IOException {
			long[] a = nextLongArray(n);
			Random r = new Random();
			for (int i = 0; i < n; i++) {
				int j = i + r.nextInt(n - i);
				long t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
			Arrays.sort(a);
			return a;
		}
	}

}

		/*input

		*/
		import java.io.ByteArrayInputStream;
		import java.io.IOException;
		import java.io.InputStream;
		import java.io.PrintWriter;
		import java.util.*;
		import java.io.*;
		public class Main {
		InputStream is;
			PrintWriter out;
			String INPUT = "";
		//class Declaration
		static class pair implements Comparable<pair>{
			int x,y;

			pair (int i,int j)
			{ x=i; y=j;

			}
			public int compareTo(pair p){
				if(this.x!=p.x) { return this.x-p.x;}
				else { return this.y-p.y;}
			}
			public int hashCode() { return (x+" "+y).hashCode();}
			public String toString(){ return x+" "+y;}
			public boolean equals(Object o){
				pair x = (pair) o ;
				return (x.x==this.x&&x.y==this.y);}
		}

	void solve() {
	long l=nl(),r=nl(),x=nl(),y=nl();
	long nl=l/x;
	long nr = r/x;
	if(y%x!=0) pn(0);
	else{
		long num=y/x;
		long cnt=0;
		for(int i=1;i*i<=num;++i){
			if(num%i==0){
				long f =num/i,s=i;
				if(f >= nl && f<=nr && s>=nl && s<=nr && gcd((int)f,(int)s)==1) {
					if(f==s) cnt++;
					else cnt+=2;
				}
			}
		}
		pn(cnt);
	}

	}

	int gcd(int a, int b)
	{
	if (b == 0)
		return a;
	return gcd(b, a % b);
	}

		void run() throws Exception
		{
				is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
				out = new PrintWriter(System.out);

				long s = System.currentTimeMillis();
				solve();
				out.flush();
				if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
		}

			public static void main(String[] args) throws Exception { new Main().run(); }

		//output methods
		private void pn(Object o)
		{
			out.println(o);
		}
		private void p(Object o)
		{
			out.print(o);
		}

		//input methods
				private byte[] inbuf = new byte[1024];
			public int lenbuf = 0, ptrbuf = 0;

			private int readByte()
			{
				if(lenbuf == -1)throw new InputMismatchException();
				if(ptrbuf >= lenbuf){
					ptrbuf = 0;
					try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
					if(lenbuf <= 0)return -1;
				}
				return inbuf[ptrbuf++];
			}

			private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
			private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

			private double nd() { return Double.parseDouble(ns()); }
			private char nc() { return (char)skip(); }

			private String ns()
			{
				int b = skip();
				StringBuilder sb = new StringBuilder();
				while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
					sb.appendCodePoint(b);
					b = readByte();
				}
				return sb.toString();
			}

			private char[] ns(int n)
			{
				char[] buf = new char[n];
				int b = skip(), p = 0;
				while(p < n && !(isSpaceChar(b))){
					buf[p++] = (char)b;
					b = readByte();
				}
				return n == p ? buf : Arrays.copyOf(buf, p);
			}

			private char[][] nm(int n, int m)
			{
				char[][] map = new char[n][];
				for(int i = 0;i < n;i++)map[i] = ns(m);
				return map;
			}

			private int[] na(int n)
			{
				int[] a = new int[n];
				for(int i = 0;i < n;i++)a[i] = ni();
				return a;
			}

			private int ni()
			{
				int num = 0, b;
				boolean minus = false;
				while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
				if(b == '-'){
					minus = true;
					b = readByte();
				}

				while(true){
					if(b >= '0' && b <= '9'){
						num = num * 10 + (b - '0');
					}else{
						return minus ? -num : num;
					}
					b = readByte();
				}
			}

			private long nl()
			{
				long num = 0;
				int b;
				boolean minus = false;
				while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
				if(b == '-'){
					minus = true;
					b = readByte();
				}

				while(true){
					if(b >= '0' && b <= '9'){
						num = num * 10 + (b - '0');
					}else{
						return minus ? -num : num;
					}
					b = readByte();
				}
			}

			private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
		}

import java.io.*;
import java.util.*;

public class cf489B{
	static long gcd(long x, long y){
       if(x%y==0){
         return y;
       }

       return gcd(y,x%y);
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();
        long ans = 0;
        //HashSet<ArrayList<Integer>>
		if(y%x!=0){
          System.out.println("0");
		}
		else{
			long d = x*y;
			for(long i=x;i<(long)(Math.sqrt(d)+1);i+=x){
               if(d%i==0){
                 long dd = d/i;
                 if(dd>=l && dd<=r && i>=l && i<=r && gcd(dd,i)==x){
                    ans+=2;
                 }
               }
			}
		}
		System.out.println(ans);
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class main {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0};
	void solve()
	{
		long l=ni();
		long r=ni();
		long x=ni();
		long y=ni();
		if(y%x!=0) {
			out.print(0);
			return;
		}
		long filter=y/x;
		long count=0;
		for(int i=1;i*i<=filter;i++)
		{
			if(filter%i==0) {
				if((filter/i)!=i) {
					long gcd=gcd(filter/i,i);
					if(gcd!=1)
						continue;
					if(i>=l&&i<=r&&(filter/i)>=l&&(filter/i)<=r)
						count+=2;
				}
			}
		}
		out.println(count);
	}
	int bsdown(ArrayList<Integer> al,int l) {
		int low=0,high=al.size()-1,ans=-1;
		while(low<=high) {
			int mid=low+(high-low)/2;
			if(al.get(mid)<=l) {
				low=mid+1;
				ans=mid;
			}else
				high=mid-1;
		}
		return ans;
	}
	ArrayList<Integer>al [];
	void take(int n,int m)
	{
		al=new ArrayList[n];
		for(int i=0;i<n;i++)
			al[i]=new ArrayList<Integer>();
		for(int i=0;i<m;i++)
		{
			int x=ni()-1;
			int y=ni()-1;
			al[x].add(y);
			al[y].add(x);

		}
	}
	int arr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)
		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	public static int count(long x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	      long x;
	      long y,k;
	      int i,h;
	      String s;
		Pair (long x,long y,int i){
			this.x=x;
			this.y=y;
			this.i=i;
		}

		public int compareTo(Pair o) {
			if(this.x!=o.x)
				return Long.compare(this.x,o.x);
			return Long.compare(this.y,o.y);
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}

	        @Override
	        public String toString() {
	            return  "("+x + " " + y +" "+k+" "+i+" )";
	        }

	    }

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(x%y==0)
			return y;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new main().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}

import java.util.*;
public class Main {
	 static int gcd(int a, int b)
	    {
	      if (b == 0)
	        return a;
	      return gcd(b, a % b);
	    }

	public static void main(String[] args) {
		Scanner s=new Scanner (System.in);
		int l=s.nextInt();
		int r=s.nextInt();
		int x=s.nextInt();
		int y=s.nextInt();
		int ans=0;
		int temp1=(y/x);
		for(int i=1;(i*i)<=temp1;i++) {
			if(temp1%i==0) {
				int j=temp1/i;
				if(l<=(i*x)&&(i*x)<=r&&l<=(j*x)&&(j*x)<=r&&gcd(i,j)==1) {
					if(i==j) {
						ans=ans+1;
					}
					else {
						ans=ans+2;
					}
				}
			}
		}
		System.out.println(ans);

	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
public class B489{
	public static void main(String[] args) {
		InputReader fi=new InputReader(System.in);
		PrintWriter pr=new PrintWriter(System.out);
		long l=fi.nextLong();
		long r=fi.nextLong();
		long x=fi.nextLong();
		long y=fi.nextLong();
		long num=x*y;
		int cnt=0;
		for (long i=1; i<=Math.sqrt(num); i=i+x)
		{
			if (num%i==0)
			{
				if (num/i == i)
				{
					long m=i;
					if(l<=m&&m<=r&&m==x&&(m*m)==y){
						//pr.printf("%d  %d\n",m,m);
						cnt++;
					}
				}
				else
				{
					long m=i;
					long n=num/i;
					long gcdvalue=0;
					if(m<n)
						gcdvalue=gcd(n,m);
					else
						gcdvalue=gcd(m,n);

					long lcmvalue=n*m/gcdvalue;

					if(l<=m&&n<=r&&gcdvalue==x&&lcmvalue==y) {
						cnt++;
						//pr.printf("%d  %d\n",m,n);

					}
					if(l<=n&&m<=r&&gcdvalue==x&&lcmvalue==y) {
						cnt++;
						//pr.printf("%d  %d\n",n,m);
					}
				}

			}
		}

		pr.println(cnt);
		pr.close();
	}
	static long gcd(long a, long b) {
		while (b != 0) {
			long t = a;
			a = b;
			b = t % b;
		}
		return a;
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n+1];
		for (int i = 1; i <= n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class codeforces
{
   static class Student{
       int x,y;
        Student(int x,int y){
            this.x=x;
            this.y=y;
            //this.z=z;
        }
    }
    static int prime[];
    static void sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        int pos=0;
        prime= new int[n+1];
        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == 0)
            {
                // Update all multiples of p
                prime[p]=p;
                for(int i = p*p; i <= n; i += p)
                    prime[i] = p;
            }
        }
    }
static    class Sortbyroll implements Comparator<Student>
{
    // Used for sorting in ascending order of
    // roll number
    public int compare(Student c, Student b)
    {
        return c.x-b.x;
    }
}
static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static class Edge{
        int a,b;
        Edge(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
    static class Trie{
        HashMap<Character,Trie>map;
         int c;
        Trie(){
            map=new HashMap<>();
            //z=null;
            //o=null;
            c=0;
        }
    }
    //static long ans;
    static int parent[];
    static int rank[];
    static int b[][];
    static int bo[];
    static int ho[];
    static int seg[];
    //static int pos;
   // static long mod=1000000007;
    //static int dp[][];
    static HashMap<Integer,Integer>map;
    static PriorityQueue<Student>q=new PriorityQueue<>();
    //static Stack<Integer>st;
   // static ArrayList<Character>ans;
    static ArrayList<ArrayList<Integer>>adj;
    static long ans;
    static Trie root;
    static long fac[];
    static int gw,gb;
    static long mod=(long)(1000000007);
    //static int ans;
    static void solve()throws IOException{
        FastReader sc=new FastReader();
        int l,r,x,y,i,o;
        long ans=0,g,lc;
        l=sc.nextInt();
        r=sc.nextInt();
        x=sc.nextInt();
        y=sc.nextInt();
        o=y;
        if(y%x!=0)
            System.out.println(0);
        else{
            y=y/x;
            for(i=1;i<=Math.sqrt(y);i++){
                if(y%i==0){
                    if(gcd(y,y/i)==(long)1&&i*x>=l&&i*x<=r&&x*(y/i)>=l&&x*(y/i)<=r){
                        if(y/i!=i)
                            ans+=2;
                        else
                            ans+=1;
                    }
                }
            }
            System.out.println(ans);
        }
    }
    static void dfs(ArrayList<ArrayList<Student>>sum,int i,int c[],int a[],int b[]){
        for(int x=0;x<adj.get(i).size();x++){
            if(c[adj.get(i).get(x)]==1)
                continue;
            gw+=a[adj.get(i).get(x)];
            gb+=b[adj.get(i).get(x)];
            sum.get(sum.size()-1).add(new Student(a[adj.get(i).get(x)],b[adj.get(i).get(x)]));
            c[adj.get(i).get(x)]=1;
            dfs(sum,adj.get(i).get(x),c,a,b);
        }
    }
    static long nCr(long n, long r,
                                    long p)
    {
        return (fac[(int)n]* modInverse(fac[(int)r], p)
                % p * modInverse(fac[(int)(n-r)], p)
                                    % p) % p;
    }
    //static int prime[];
    //static int dp[];
    public static void main(String[] args){
        //long sum=0;
        try {
                codeforces.solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }
       static long modInverse(long n, long p)
    {
        return power(n, p-(long)2,p);
    }
 static long power(long x, long y, long p)
{
    long res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y %(long)2!=0)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
 }
    /*public static long power(long x,long a) {
		if(a==0) return 1;
		if(a%2==1)return (x*1L*power(x,a-1))%mod;
		return (power((int)((x*1L*x)%mod),a/2))%mod;
	}*/
   static int find(int x)
    {
        // Finds the representative of the set
        // that x is an element of
        while(parent[x]!=x)
        {
            // if x is not the parent of itself
            // Then x is not the representative of
            // his set,
            x=parent[x];

            // so we recursively call Find on its parent
            // and move i's node directly under the
            // representative of this set
        }

        return x;
    }
    static void union(int x, int y)
    {
        // Find representatives of two sets
        int xRoot = find(x), yRoot = find(y);

        // Elements are in the same set, no need
        // to unite anything.
        if (xRoot == yRoot)
            return;

         // If x's rank is less than y's rank
        if (rank[xRoot] < rank[yRoot])

            // Then move x under y  so that depth
            // of tree remains less
            parent[xRoot] = yRoot;

        // Else if y's rank is less than x's rank
        else if (rank[yRoot] < rank[xRoot])

            // Then move y under x so that depth of
            // tree remains less
            parent[yRoot] = xRoot;

        else // if ranks are the same
        {
            // Then move y under x (doesn't matter
            // which one goes where)
            parent[yRoot] = xRoot;

            // And increment the the result tree's
            // rank by 1
            rank[xRoot] = rank[xRoot] + 1;
        }
    }
    static long gcd(long a, long b)
    {
        if (a == 0){
             //ans+=b;
            return b;
        }
        return gcd(b % a, a);
    }
}

import javax.xml.crypto.dsig.keyinfo.KeyName;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static int gcd(int a, int b){
        while (a>0 && b>0){
            if (a>b) a%=b; else b%=a;
        }
        return a+b;
    }

    public static void main(String[] args) throws IOException {
        int x=read();
        int y=read();
        int l=read();
        int r=read();
        if (y%x!=0){
            System.out.println(0);
            System.exit(0);
        }
        y/=x;
        int cnt=0;
        for (int i=1; i<100000; i++){
            if (y%(i*x*x)==0){
                int j=y/(i*x*x);
                if (i*x>=l && i*x<=r && j*x>=l && j*x<=r && gcd(i,j)==1){
                    if (i==j) cnt++;
                    if (i<j) cnt+=2;
                }
            }
        }
        System.out.println(cnt);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class A {
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        long l = Reader.nextInt();
        long r = Reader.nextInt();
        long x = Reader.nextInt();
        long y = Reader.nextInt();
        long iii = x*y;
        long te = (long)Math.sqrt(iii);
        long count = 0;
        long L = (l + x -1)/x;
        long R = te/x;
        for(long i = L; i <= R; i++){
            if(y%i == 0 && gcd(i ,y/i  ) == 1){count++;}
        }
        if(te*te == iii && te == x) System.out.println(Math.max(count*2 - 1, 0));
        else  System.out.println(count*2);

    }

    static long gcd(long a, long b){
        if(a == 0){return b;}
        return gcd(b%a, a);
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");

    }

    static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            tokenizer = new StringTokenizer(

                    reader.readLine() );

        }
        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() {

        return Long.parseLong(nextToken());
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vaibhav Pulastya
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BNastyaStudiesInformatics solver = new BNastyaStudiesInformatics();
        solver.solve(1, in, out);
        out.close();
    }

    static class BNastyaStudiesInformatics {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();
            int count = 0;
            for (long a = l; a * a <= y && a <= r; a++) {
                if (y % a == 0) {
                    long b = (x * y) / a;
                    if (gcd(a, b) != x) continue;
                    if (b <= r && b >= l) count++;
                    if (a != b) count++;
                }
            }
            out.println(count);
        }

        long gcd(long a, long b) {
            if (a < b) return gcd(b, a);
            if (b == 0) return a;
            return gcd(b, a % b);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        long l = in.nextInt();
        long r = in.nextInt();
        long x = in.nextInt();
        long y = in.nextInt();

        if (y%x != 0){
            out.println(0);
            return;
        }

        if (x >= r || y <= l){
            out.println(0);
            return;
        }

        long ans = 0;
        for (long a = x; a <= Math.sqrt(x*y); a+=x) {
            long b = x*y/a;
            debug.print(a + " " + b);

            if (a >= l && a <= r && b >= l && b <= r){
                debug.print(" +");

                    if (gcd(a,b)==x && lcm(a,b)==y){
                        debug.print(" +");
                        ans++;
                    }
            }

            debug.println("");
        }

        out.println(ans*2);
    }

    static long gcd (long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }

    static long lcm (long a, long b) {
        return a / gcd (a, b) * b;
    }

    public static final String NAME = "";

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            if (NAME.length() > 0) {
                in = new InputReader(new BufferedReader(new FileReader(NAME + ".in")));
                out = new PrintWriter(new FileWriter(NAME + ".out"));
            } else {
                in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            debug = new DebugWriter(false);
            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException{
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long x = in.nextInt();
            long y = in.nextInt();
            long xy = x * y;
            long ans = 0;
            for (long a = l; a * a <= r; a++) {
                if (xy % a == 0) {
                    long b = xy / a;
                    if (gcd(a, b) == x && lcm(a, b) == y) {
                        if (a == b) ans++;
                        else ans += 2;
                    }
                }
            }
            if (x == y && x * x >= r) ans++;
            out.println(ans);
        }

        long gcd(long a, long b) {
            if (b == 0) return a;
            return gcd(b, a % b);
        }

        long lcm(long a, long b) {
            return (a * b) / gcd(a, b);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class B {

	static long l,r,x,y;
	public static void main(String[] args) {
		JS in = new JS();
		l = in.nextLong();
		r = in.nextLong();
		x = in.nextLong();
		y = in.nextLong();

		long res = 0;
		ArrayList<Integer> nums = new ArrayList<Integer>();
		for(int i = 1; i*i <= y; i++) {
			if(y%i == 0) {
				long aa = i;
				long bb = y/i;
				if(gcd(aa,bb) == x) {
					if(aa!=bb)res+=2;
					else res++;
				}

			}
		}
		System.out.println(res);

	}

	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long lcm(long a, long b){
		return a*(b/gcd(a, b));
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakhar897
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {

            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long mul = x * y;

            long b, m, n;
            long count = 0, i;

            if (x > r || y % x != 0) {
                out.println(0);
                return;
            }

            y /= x;
            if (x == y && x <= r) {
                out.println(1);
                return;
            }
            for (i = l; i * i <= y; i++) {
                if (mul % i == 0) {
                    b = mul / i;
                    //a,b == i,b
                    if (b >= l && b <= r && i >= l && i <= r) {
                        if (gcd(i, b) == x) {
                            n = i / x;
                            m = b / x;
                            if (n * m == y) {
                                count += 2;
                                if (i == b)
                                    --count;
                            }
                        }
                    }
                }
            }

            out.println(count);

        }

        public long gcd(long a, long b) {
            return (a % b == 0 ? b : gcd(b, a % b));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
   InputStream is;
	PrintWriter out;
	String INPUT = "";
 //class Declarations
void solve()
{
int l=ni(),r=ni(),x=ni(),y=ni();
int div=y/x;
boolean[] prime=new boolean[(int)(1e5)+10];
ArrayList<Integer> al=new ArrayList<>();
for(int i=2;i*i<prime.length;++i){
    if(!prime[i]){
        int j=i+i;
        while(j<prime.length) {
            prime[j]=true;
            j=j+i;
        }
    }
}
for(int i=2;i<prime.length;++i) if(!prime[i]) al.add(i);
//pn(al.size());
ArrayList<Integer> fact=new ArrayList<>();
// System.out.println("Reached");
     for(int z:al){
      if(div==1) break;
         int ans=1;
        // pn("div "+div);
        boolean f=false;
            while(div%z==0){
                f=true;
                ans*=z;
                div/=z;
            }
        if(f) fact.add(ans);

    }
//pn(fact);
int permut=1<<fact.size();
int cnt=0;
for(int i=0;i<permut;++i){
    int left=1,right=1;
    for(int j=0;j<fact.size();++j){
        int bit=(i>>j)&1;
        if(bit==1){
            left*=fact.get(j);
        }
        else{
            right*=fact.get(j);
        }
    }
    left=left*x;right*=x;
    if(left>=l&&left<=r&&right>=l&&right<=r)  cnt++;
}
pn(cnt);

}
int min(int[] arr)
{
    int min=Integer.MAX_VALUE;
    for(int i=0;i<arr.length;++i)
    {
        if(min>arr[i]) min=arr[i];
    }
    return min;
}
int max(int[] arr)
{
    int max=Integer.MIN_VALUE;
    for(int i=0;i<arr.length;++i)
    {
        if(max<arr[i]) max=arr[i];
    }
    return max;
}
static int gcd(int x,int y)
{
  if(y==0) return x;
  return gcd(y,x%y);
}
static long nCr(long n,long rc)
{
 long r=Math.min(rc,n-rc);
 long ans=1;
 for(int i=1,j=(int)n;i<=r;++i,--j)
 {
   ans=(ans*(long)j)/((long)i);
 }
  return ans;

}

void run() throws Exception
{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
}

	public static void main(String[] args) throws Exception { new Main().run(); }

//output methods
private void pn(Object o)
{
	out.println(o);
}
private void p(Object o)
{
	out.print(o);
}

//input methods
		private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}
class pair implements Comparable<pair>{
    int x,y;
    pair (int i,int j)
    {
        x=i;
        y=j;

    }

    public int compareTo(pair p)
    {
        if(this.x!=p.x)
        {
            return this.x-p.x;
        }
        else
        {
            return this.y-p.y;
        }
    }
    public boolean equals(pair x)
    {
        return (x.x==this.x&&x.y==this.y);
    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Integer.parseInt(st.nextToken());
        long r = Integer.parseInt(st.nextToken());
        long gcd = Integer.parseInt(st.nextToken());
        long lcm = Integer.parseInt(st.nextToken());
        long n = gcd*lcm;
        int sqrt = (int) Math.sqrt(lcm)+1;
        long res = 0;
        for (int i = 1; i <= sqrt; i++) {
            if (lcm % i == 0) {
                long x = lcm/i;
                if (i >= l && i <= r && x >= l && x <= r) {
                    if (lcm(i, x) == lcm && gcd(i, x) == gcd) {
                        if (i == x) {
                            res++;
                        } else {
                            res += 2;
                        }
                    }
                }
            }
        }
        System.out.println(res);
    }
    static long gcd(long p, long q) {
        if (q == 0) return p;
        else return gcd(q, p % q);
    }
    static long lcm(long a, long b) {
        return (a*b)/(gcd(a,b));
    }
}
/*

 */

import java.util.HashSet;
import java.util.Scanner;

public class A489 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		long x = sc.nextLong();
		long y = sc.nextLong();
		long mul = Math.max(x, y);
		long min = x * y / mul;
		long count = 0;
		HashSet<Long> h = new HashSet<Long>();
		for (int i = l; i <= Math.sqrt(mul); i++) {
			if (mul % i == 0 && min * i <= r && mul / i <= r && gcd(min * i, mul / i) == x && !h.contains(min * i)) {
				if (min * i != mul / i)
					count += 2;
				else
					count++;
				h.add(min * i);
				h.add(mul / i);
				// System.out.println(min * i + " " + mul / i);
			}
		}
		System.out.println(count);
	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
}

import java.util.*;
import java.io.*;
public class B {

	static int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
		public static void main(String[] args) throws IOException {
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter (System.out);
			int l=sc.nextInt(),r=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
			int ans=0;
			if(y%x==0) {
				int target=y/x;
				for(int i=1;i*i<=target;i++)
				{
					int j=target/i;
					if(gcd(i, j)!=1)
						continue;
					if(i>=l && i<=r)
						ans++;
					if(i!=j && j>=l && j<=r)
						ans++;

				}

			}
			pw.println(ans);

			pw.close();
		}

	static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException { return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}

    }

}

import java.util.*;
public class NastyaStudiesInformatics {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();

		long mult = x * y;
		long count = 0;
		long i;
		if(l>x)
			i=l;
		else
			i=x;
		long s = (long)Math.sqrt(mult);
		for(;i<=s;i=i+x)
		{
			if((mult%i)==0)
			{
				long p = (mult/i);
				if(p>=l && p<=r)
				{
					long g = gcd(i,p);
					if(g==x)
					count += 2;
					if(i==p)
						count--;
				}
			}
		}

		System.out.println(count);
	}

	public static long gcd(long A,long B)
	{
		if(B==0)	return A;

		return gcd(B,A%B);
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rishabhdeep Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        List<Integer> divisors(int n) {
            List<Integer> set = new ArrayList<>();
            for (int i = 1; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    if ((n / i) == i)
                        set.add(i);
                    else
                        set.add(n / i);
                }
            }
            return set;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int l = in.nextInt(), r = in.nextInt(), gcd = in.nextInt(), lcm = in.nextInt();
            List<Integer> list = divisors(lcm);
            Set<TaskB.Pair<Integer, Integer>> set = new HashSet<>();
            for (int i = 0; i < list.size(); i++) {
                int a = lcm / list.get(i);
                int b = gcd * list.get(i);
                long GCD = Utilities.gcd(a, b);
//            out.println("A = " + a + " B = " + b + " GCD = " + GCD);
                if (GCD == gcd && a * b == lcm * GCD)
                    if (l <= a && a <= r && l <= b && b <= r) {
                        TaskB.Pair<Integer, Integer> p = new TaskB.Pair<>(a, b);
                        TaskB.Pair<Integer, Integer> q = new TaskB.Pair<>(b, a);
                        set.add(p);
                        if (a != b)
                            set.add(q);
                    }
            }
            out.println(set.size());
        }

        public static class Pair<first, second> {
            public first First;
            public second Second;

            public Pair(first First, second Second) {
                this.First = First;
                this.Second = Second;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class Utilities {
        public static long gcd(long a, long b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputReader input_reader = new InputReader(System.in);
        OutputWriter output_writer = new OutputWriter(System.out);
        ProblemSolver solver = new ProblemSolver();
        solver.solve(input_reader, output_writer);
        output_writer.flush();
        output_writer.close();
    }

    private static class ProblemSolver {

        long GCD(long a, long b) {
            long x = Math.max(a,b);
            long y = Math.min(a,b);
            if (x%y==0l) {
                return y;
            }
            return GCD(x%y, y);
        }

        public void solve(InputReader input, OutputWriter output)
                throws IOException {
            long L = input.nextLong(), R = input.nextLong(), X = input.nextLong(), Y = input.nextLong();
            long bound = (long)Math.floor(Math.sqrt(X*Y));
            long prod = X*Y;
            long result = 0l;
            for (long i=X;i<=bound && i>=L && i<=R;i+=X) {
                long see = prod/i;
                if ((X*Y)%i==0l && GCD(see, i)==X) {
                    if (see==i) {
                        result++;
                    } else {
                        result += 2l;
                    }
                }
            }
            output.printLine(result);
            output.flush();
        }
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

    private static class OutputWriter {

        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.util.*;
import java.io.*;
import java.math.*;
public class main {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0};
	void solve()
	{
		long l=ni();
		long r=ni();
		long x=ni();
		long y=ni();
		if(y%x!=0) {
			out.print(0);
			return;
		}
		long filter=y/x;
		long count=0;
		for(int i=1;i*i<=filter;i++)
		{
			if(filter%i==0) {
				if((filter/i)!=i) {
					long gcd=gcd(filter/i,i);
					if(gcd!=1)
						continue;
					if(i>=l&&i<=r&&(filter/i)>=l&&(filter/i)<=r)
						count+=2;
				}
				else if(i==1&&i>=l&&i<=r)
					count++;
			}
		}
		out.println(count);
	}
	int bsdown(ArrayList<Integer> al,int l) {
		int low=0,high=al.size()-1,ans=-1;
		while(low<=high) {
			int mid=low+(high-low)/2;
			if(al.get(mid)<=l) {
				low=mid+1;
				ans=mid;
			}else
				high=mid-1;
		}
		return ans;
	}
	ArrayList<Integer>al [];
	void take(int n,int m)
	{
		al=new ArrayList[n];
		for(int i=0;i<n;i++)
			al[i]=new ArrayList<Integer>();
		for(int i=0;i<m;i++)
		{
			int x=ni()-1;
			int y=ni()-1;
			al[x].add(y);
			al[y].add(x);

		}
	}
	int arr[][];
	int small[];
	void pre(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)
		{
			for(int j=i;j*i<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=0;i<=n;i++)
		{
			if(small[i]==0)
				small[i]=i;
		}
	}
	public static int count(long x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	      long x;
	      long y,k;
	      int i,h;
	      String s;
		Pair (long x,long y,int i){
			this.x=x;
			this.y=y;
			this.i=i;
		}

		public int compareTo(Pair o) {
			if(this.x!=o.x)
				return Long.compare(this.x,o.x);
			return Long.compare(this.y,o.y);
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}

	        @Override
	        public String toString() {
	            return  "("+x + " " + y +" "+k+" "+i+" )";
	        }

	    }

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(x%y==0)
			return y;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new main().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}

import java.util.*;
import java.io.*;
public class B {

	static int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
		public static void main(String[] args) throws IOException {
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter (System.out);
			int l=sc.nextInt(),r=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
			int ans=0;
			if(y%x==0) {
				int target=y/x;
				for(int i=1;i*1L*i<=target;i++)
				{
					if(target%i!=0)
						continue;
					int j=target/i;
					if(gcd(i, j)!=1)
						continue;
					if(i>=l && i<=r)
						ans++;
					if(i!=j && j>=l && j<=r)
						ans++;

				}

			}
			pw.println(ans);

			pw.close();
		}

	static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException { return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}

    }

}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Solution
{
    static class InputReader
	{
	    private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

	    public InputReader(InputStream st) {
	      this.stream = st;
	    }

	    public int read() {
	      if (snumChars == -1)
	        throw new InputMismatchException();
	      if (curChar >= snumChars) {
	        curChar = 0;
	        try {
	          snumChars = stream.read(buf);
	        } catch (IOException e) {
	          throw new InputMismatchException();
	        }
	        if (snumChars <= 0)
	          return -1;
	      }
	      return buf[curChar++];
	    }

	    public int nextInt() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      int res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public long nextLong() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      long res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public int[] nextIntArray(int n) {
	      int a[] = new int[n];
	      for (int i = 0; i < n; i++) {
	        a[i] = nextInt();
	      }
	      return a;
	    }

	    public String readString() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isSpaceChar(c));
	      return res.toString();
	    }

	    public String nextLine() {
	      int c = read();
	      while (isSpaceChar(c))
	        c = read();
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isEndOfLine(c));
	      return res.toString();
	    }

	    public boolean isSpaceChar(int c) {
	      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }

	    private boolean isEndOfLine(int c) {
	      return c == '\n' || c == '\r' || c == -1;
	    }
	}
    public static int gcd(int a,int b)
    {
        if(a==0)
            return b;

        return gcd(b%a,a);
    }
    public static void main(String[] args) throws IOException
    {
        InputReader in=new InputReader(System.in);
        int l=in.nextInt();
        int r=in.nextInt();
        int x=in.nextInt();
        int y=in.nextInt();
        ArrayList<Integer> list=new ArrayList<Integer>();
        for(int i=1;i<=(int)Math.sqrt(y);i++)
        {
            if(y%i==0)
            {
                list.add(i);
                list.add((y/i));
            }
        }
        Collections.sort(list);

        long count=0;
        for(int i=0;i<list.size()/2;i++)
        {
            int e1=list.get(i);
            for(int j=list.size()-1;j>=list.size()-i-1;j--)
            {
                int e2=list.get(j);
                //if(e2%e1!=0)
                //{
                    if(e1>=l && e1<=r && e2>=l && e2<=r && gcd(e1,e2)==x)
                    {
                        //System.out.println(e1+" "+e2);
                        if(e1!=e2)
                        {
                            count=count+2L;
                        }
                        else
                        {
                            count=count+1L;
                        }
                    }
                //}
            }
        }
        System.out.println(count);
    }
}

import java.io.*;
import java.util.*;

public	 class template
	{
		private InputStream is;
		private PrintWriter pw;
		static char[][] ch;
		static int  x1,x2,y1,y2,n,m,h,k;
		static long dist[][];
		static boolean boo[][];

		void soln()
		{
			is = System.in;
			pw = new PrintWriter(System.out);
			long s = System.currentTimeMillis();
			solve();
			pw.close();
			pw.flush();
			// tr(System.currentTimeMillis() - s + "ms");
		}

		public static void main(String[] args) throws Exception
		{
			new Thread(null, new Runnable()
			{
				public void run()
				{
					try
					{
						// new CODEFORCES().soln();
					} catch (Exception e)
					{
						System.out.println(e);
					}
				}
			}, "1", 1 << 26).start();
			new template().soln();
		}

		void solve()
		{
			long l = ni(), r = ni(), x = ni(), y = ni();
			long mul = x*y;
			int cnt = 0;
			if(x==y && x>=l && x<=r) {pw.println(1);return;}
			for(long i = Math.max(l,mul/r); i*i<= Math.min(r,mul/l);i++){
				//pw.println(i);
				if(mul%i==0 && gcd(i,mul/i)==x){
					//pw.println(i);
					if(mul/i != i) cnt+=2;
					else cnt++;
				}
			}
			pw.println(cnt);
			pw.close();
		}
		long gcd(long a, long b){
			if(b==0) return a;
			return gcd(b,a%b);
		}
		void printArray(long[] arr) {
			for(long i : arr) pw.print(i +" ");
			pw.println();
		}
	static long min(long x, long y){
		return (x<y)?x:y;
	}
	static class Pair implements Comparable<Pair>{
		long val;
		int  x, y;
		Pair(long v, int a, int b){
			val = v; x = a; y = b;
		}
		public int compareTo(Pair p){
			return Long.compare(this.val,p.val);
		}
	}
	private static class Queue{
		int st = 0;
		int et = 0;
		Pair[] arr;
		public Queue(int len) {
			arr = new Pair[len];
		}
		public boolean isEmpty() {
			return st==et;
		}
		public void add(Pair x) {
			arr[et++] = x;
		}
		public Pair poll() {
			return arr[st++];
		}
		public void clear() {
			st = et = 0;
		}
	}
		/*void bfs(int k) {
			while(!q.isEmpty()) {
				int y = q.poll();
				for(long i : amp[y]) {
					if(!b[i]) {
						D[i][k] = D[y][k]+1;
						q.add(i);
						b[i] = true;
					}
				}
			}
		}
		*/
		/*
		int dfs(int x) {
			b[x] = true;
			//start[x] = time++;
			int ans = 1;
			for(int i : amp[x]) {
				if(!b[i]) {
					ans += dfs(i);
				}
			}
			//end[x] = time;
			if(x!= 0 && ans%2==0 && (N-ans)%2==0) cost++;

			return ans;
		}*/

		/*void buildGraph(int n)
		{
			for (int i = 0; i < n; i++)
			{
				int x1 = ni() - 1, y1 = ni() - 1;
				amp[x1].add(y1);
				amp[y1].add(x1);
			}
		}*/
		public static int[] shuffle(int[] a, Random gen)
		{
			for (int i = 0, n = a.length; i < n; i++)
			{
				int ind = gen.nextInt(n - i) + i;
				int d = a[i];
				a[i] = a[ind];
				a[ind] = d;
			}
			return a;
		}
		// To Get Input
		// Some Buffer Methods
		private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte()
		{
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf)
			{
				ptrbuf = 0;
				try
				{
					lenbuf = is.read(inbuf);
				} catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c)
		{
			return !(c >= 33 && c <= 126);
		}

		private int skip()
		{
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		private double nd()
		{
			return Double.parseDouble(ns());
		}

		private char nc()
		{
			return (char) skip();
		}

		private String ns()
		{
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b)))
			{ // when nextLine, (isSpaceChar(b) && b != '
										// ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n)
		{
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b)))
			{
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m)
		{
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n)
		{
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}

		private int ni()
		{
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl()
		{
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-')
			{
				minus = true;
				b = readByte();
			}

			while (true)
			{
				if (b >= '0' && b <= '9')
				{
					num = num * 10 + (b - '0');
				} else
				{
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

		private void tr(Object... o)
		{
			if (!oj)
				System.out.println(Arrays.deepToString(o));
		}
	}

import java.io.*;
import java.util.*;
import java.math.*;
public class cf489b
{
	public static int M = 1000000007;
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String[] s = br.readLine().split(" ");
        int l = Integer.parseInt(s[0]);
        int r = Integer.parseInt(s[1]);
        long x = Long.parseLong(s[2]);
        long y = Long.parseLong(s[3]);
        int c=0;
        ArrayList<Integer> res = printDivisors(y,x,y);
        for(int i=0;i<res.size();i+=2)
        {
            if(res.get(i)>=l && res.get(i)<=r && res.get(i+1)>=l && res.get(i+1)<=r)
            {
                    c++;
            }
        }
        //out.println(res);
        out.println(c*2);
        out.flush();
    }
    /** Loops
    *	i: for(int i=0;i<n;i++)
    *	j: for(int j=0;j<n;j++)
    *	k: for(int k=0;k<n;k++)

    *	ArrayList<Integer> arr1 = new ArrayList<>();

    * 	HashMap
    *	HashMap<Integer, Integer> hm = new HashMap<>();
    * 	for (Map.Entry<String,String> entry : hm.entrySet())
    		out.println(entry.getValue());

    *	Count frequencies
    	for(int i=0;i<n;i++)
        {
            Integer c = hm.get(Integer.parseInt(s[i]));
            if(c==null)
                hm.put(Integer.parseInt(s[i]),1);
            else
                hm.put(Integer.parseInt(s[i]),++c);
        }
	**/
    public static long modularExpo(long x,long n,int M)
	{
		long result=1;
		while(n>0)
		{
		    if(n%2==1)
		        result=(result*x)%M;
		    x=(x*x)%M;
		    n=n/2;
		}
		return result;
	}
	//FLT, only when a and M are co-prime
	public static long modInverse(int a,int M)
	{
		long g = gcd(a,M);
		if(g!=1)
			return -1;
	    return modularExpo(a,M-2,M);
	}
	public static long gcd(long a, long b)
	{
	    if(b==0)
	        return a;
	    else
	        return gcd(b, a % b);
	}
    public static long lcm(long a, long b)
    {
        if(b==0||a==0)
            return 0;
        else
            return (a*b)/gcd(a,b);
    }
    public static ArrayList<Integer> printDivisors(long n, long x, long y)
    {
        // Note that this loop runs till square root
        ArrayList<Integer> a = new ArrayList<>();
        for (int i=1; i<=(int)Math.sqrt(n); i++)
        {
            if (n%i == 0)
            {
                // If divisors are equal, print only one
                if (n/i != i && (gcd(i,(int)n/i)==x) && (lcm(i,(int)n/i)==y))
                {
                    a.add(i);
                    a.add((int)n/i);
                }
            }
        }
        return a;
    }
}

//package baobab;
import java.io.*;
import java.util.*;

public class B {

    public static void main(String[] args) {
        Solver solver = new Solver();
    }

    static class Solver {
        IO io;

        public Solver() {
            this.io = new IO();
            try {
                solve();
            } catch (RuntimeException e) {
                if (!e.getMessage().equals("Clean exit")) {
                    throw e;
                }
            } finally {
                io.close();
            }
        }

        /****************************** START READING HERE ********************************/

        void solve() {
            long ansCount = 0;

            long l = io.nextLong();
            long r = io.nextLong();
            long x = io.nextLong();
            long y = io.nextLong();

            long goal = x*y;

            long a=l;
            for (; a<=r && a<=50000; a++) {
                long b = goal/a;
                if (a > b) break;
                if (goal%a != 0) continue;
                if (b > r) continue;

                long bah = gcd(a, b);
                if (bah != x) continue; // gcd check
                if (a*b != y*bah) continue; // lcm check

                //System.out.println("What makes " + goal + "? " + a + " and " + b);
                if (a == b) {
                    ansCount++;
                } else {
                    ansCount += 2;
                }
            }

            io.println(ansCount);
        }

        long gcd(long a, long b) {
            /** Euclidean algorithm. */
            if (b == 0) return a;
            return gcd(b, a%b);
        }

        long lcm(long a, long b) {
            /** Least common multiple */
            return a * b / gcd(a,b);
        }

        /************************** UTILITY CODE BELOW THIS LINE **************************/

        long MOD = (long)1e9 + 7;

        boolean closeToZero(double v) {
            // Check if double is close to zero, considering precision issues.
            return Math.abs(v) <= 0.0000000000001;
        }

        class DrawGrid {

            void draw(boolean[][] d) {
                System.out.print("  ");
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(" " + x + " ");
                }
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print((d[y][x] ? "[x]" : "[ ]"));
                    }
                    System.out.println("");
                }
            }

            void draw(int[][] d) {
                int max = 1;
                for (int y=0; y<d.length; y++) {
                    for (int x=0; x<d[0].length; x++) {
                        max = Math.max(max, ("" + d[y][x]).length());
                    }
                }
                System.out.print("  ");
                String format = "%" + (max+2) + "s";
                for (int x=0; x<d[0].length; x++) {
                    System.out.print(String.format(format, x) + " ");
                }
                format = "%" + (max) + "s";
                System.out.println("");
                for (int y=0; y<d.length; y++) {
                    System.out.print(y + " ");
                    for (int x=0; x<d[0].length; x++) {
                        System.out.print(" [" + String.format(format, (d[y][x])) + "]");
                    }
                    System.out.println("");
                }
            }

        }

        class IDval implements Comparable<IDval> {
            int id;
            long val;

            public IDval(int id, long val) {
                this.val = val;
                this.id = id;
            }

            @Override
            public int compareTo(IDval o) {
                if (this.val < o.val) return -1;
                if (this.val > o.val) return 1;
                return this.id - o.id;
            }
        }

        private class ElementCounter {
            private HashMap<Long, Integer> elements;

            public ElementCounter() {
                elements = new HashMap<>();
            }

            public void add(long element) {
                int count = 1;
                Integer prev = elements.get(element);
                if (prev != null) count += prev;
                elements.put(element, count);
            }

            public void remove(long element) {
                int count = elements.remove(element);
                count--;
                if (count > 0) elements.put(element, count);
            }

            public int get(long element) {
                Integer val = elements.get(element);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class StringCounter {
            HashMap<String, Integer> elements;

            public StringCounter() {
                elements = new HashMap<>();
            }

            public void add(String identifier) {
                int count = 1;
                Integer prev = elements.get(identifier);
                if (prev != null) count += prev;
                elements.put(identifier, count);
            }

            public void remove(String identifier) {
                int count = elements.remove(identifier);
                count--;
                if (count > 0) elements.put(identifier, count);
            }

            public long get(String identifier) {
                Integer val = elements.get(identifier);
                if (val == null) return 0;
                return val;
            }

            public int size() {
                return elements.size();
            }
        }

        class DisjointSet {
            /** Union Find / Disjoint Set data structure. */
            int[] size;
            int[] parent;
            int componentCount;

            public DisjointSet(int n) {
                componentCount = n;
                size = new int[n];
                parent = new int[n];
                for (int i=0; i<n; i++) parent[i] = i;
                for (int i=0; i<n; i++) size[i] = 1;
            }

            public void join(int a, int b) {
                /* Find roots */
                int rootA = parent[a];
                int rootB = parent[b];
                while (rootA != parent[rootA]) rootA = parent[rootA];
                while (rootB != parent[rootB]) rootB = parent[rootB];

                if (rootA == rootB) {
                    /* Already in the same set */
                    return;
                }

                /* Merge smaller set into larger set. */
                if (size[rootA] > size[rootB]) {
                    size[rootA] += size[rootB];
                    parent[rootB] = rootA;
                } else {
                    size[rootB] += size[rootA];
                    parent[rootA] = rootB;
                }
                componentCount--;
            }

        }

        class Trie {
            int N;
            int Z;
            int nextFreeId;
            int[][] pointers;
            boolean[] end;

            /** maxLenSum = maximum possible sum of length of words */
            public Trie(int maxLenSum, int alphabetSize) {
                this.N = maxLenSum;
                this.Z = alphabetSize;
                this.nextFreeId = 1;
                pointers = new int[N+1][alphabetSize];
                end = new boolean[N+1];
            }

            public void addWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) {
                        next = nextFreeId++;
                        pointers[curr][c] = next;
                    }
                    curr = next;
                }
                end[curr] = true;
            }

            public boolean hasWord(String word) {
                int curr = 0;
                for (int j=0; j<word.length(); j++) {
                    int c = word.charAt(j) - 'a';
                    int next = pointers[curr][c];
                    if (next == 0) return false;
                    curr = next;
                }
                return end[curr];
            }

        }

        private static class Prob {

            /** For heavy calculations on probabilities, this class
             *  provides more accuracy & efficiency than doubles.
             *  Math explained: https://en.wikipedia.org/wiki/Log_probability
             *  Quick start:
             *      - Instantiate probabilities, eg. Prob a = new Prob(0.75)
             *      - add(), multiply() return new objects, can perform on nulls & NaNs.
             *      - get() returns probability as a readable double */

            /** Logarithmized probability. Note: 0% represented by logP NaN. */
            private double logP;

            /** Construct instance with real probability. */
            public Prob(double real) {
                if (real > 0) this.logP = Math.log(real);
                else this.logP = Double.NaN;
            }

            /** Construct instance with already logarithmized value. */
            static boolean dontLogAgain = true;
            public Prob(double logP, boolean anyBooleanHereToChooseThisConstructor) {
                this.logP = logP;
            }

            /** Returns real probability as a double. */
            public double get() {
                return Math.exp(logP);
            }

            @Override
            public String toString() {
                return ""+get();
            }

            /***************** STATIC METHODS BELOW ********************/

            /** Note: returns NaN only when a && b are both NaN/null. */
            public static Prob add(Prob a, Prob b) {
                if (nullOrNaN(a) && nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                if (nullOrNaN(a)) return copy(b);
                if (nullOrNaN(b)) return copy(a);

                double x = Math.max(a.logP, b.logP);
                double y = Math.min(a.logP, b.logP);
                double sum = x + Math.log(1 + Math.exp(y - x));
                return new Prob(sum, dontLogAgain);
            }

            /** Note: multiplying by null or NaN produces NaN (repping 0% real prob). */
            public static Prob multiply(Prob a, Prob b) {
                if (nullOrNaN(a) || nullOrNaN(b)) return new Prob(Double.NaN, dontLogAgain);
                return new Prob(a.logP + b.logP, dontLogAgain);
            }

            /** Returns true if p is null or NaN. */
            private static boolean nullOrNaN(Prob p) {
                return (p == null || Double.isNaN(p.logP));
            }

            /** Returns a new instance with the same value as original. */
            private static Prob copy(Prob original) {
                return new Prob(original.logP, dontLogAgain);
            }
        }

        class Binary implements Comparable<Binary> {

            /**
             * Use example: Binary b = new Binary(Long.toBinaryString(53249834L));
             *
             * When manipulating small binary strings, instantiate new Binary(string)
             * When just reading large binary strings, instantiate new Binary(string,true)
             * get(int i) returns a character '1' or '0', not an int.
             */

            private boolean[] d;
            private int first; // Starting from left, the first (most remarkable) '1'
            public int length;

            public Binary(String binaryString) {
                this(binaryString, false);
            }
            public Binary(String binaryString, boolean initWithMinArraySize) {
                length = binaryString.length();
                int size = Math.max(2*length, 1);
                first = length/4;
                if (initWithMinArraySize) {
                    first = 0;
                    size = Math.max(length, 1);
                }
                d = new boolean[size];
                for (int i=0; i<length; i++) {
                    if (binaryString.charAt(i) == '1') d[i+first] = true;
                }
            }

            public void addFirst(char c) {
                if (first-1 < 0) doubleArraySize();
                first--;
                d[first] = (c == '1' ? true : false);
                length++;
            }

            public void addLast(char c) {
                if (first+length >= d.length) doubleArraySize();
                d[first+length] = (c == '1' ? true : false);
                length++;
            }

            private void doubleArraySize() {
                boolean[] bigArray = new boolean[(d.length+1) * 2];
                int newFirst = bigArray.length / 4;
                for (int i=0; i<length; i++) {
                    bigArray[i + newFirst] = d[i + first];
                }
                first = newFirst;
                d = bigArray;
            }

            public boolean flip(int i) {
                boolean value = (this.d[first+i] ? false : true);
                this.d[first+i] = value;
                return value;
            }

            public void set(int i, char c) {
                boolean value = (c == '1' ? true : false);
                this.d[first+i] = value;
            }

            public char get(int i) {
                return (this.d[first+i] ? '1' : '0');
            }

            @Override
            public int compareTo(Binary o) {
                if (this.length != o.length) return this.length - o.length;
                int len = this.length;
                for (int i=0; i<len; i++) {
                    int diff = this.get(i) - o.get(i);
                    if (diff != 0) return diff;
                }
                return 0;
            }

            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                for (int i=0; i<length; i++) {
                    sb.append(d[i+first] ? '1' : '0');
                }
                return sb.toString();
            }

        }

        /************************** Range queries **************************/

        class FenwickMin {
            long n;
            long[] original;
            long[] bottomUp;
            long[] topDown;

            public FenwickMin(int n) {
                this.n = n;
                original = new long[n+2];
                bottomUp = new long[n+2];
                topDown = new long[n+2];
            }

            public void set(int modifiedNode, long value) {
                long replaced = original[modifiedNode];
                original[modifiedNode] = value;
                // Update left tree
                int i = modifiedNode;
                long v = value;
                while (i <= n) {
                    if (v > bottomUp[i]) {
                        if (replaced == bottomUp[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i-x;
                                v = Math.min(v, bottomUp[child]);
                            }
                        } else break;
                    }
                    if (v == bottomUp[i]) break;
                    bottomUp[i] = v;
                    i += (i&-i);
                }
                // Update right tree
                i = modifiedNode;
                v = value;
                while (i > 0) {
                    if (v > topDown[i]) {
                        if (replaced == topDown[i]) {
                            v = Math.min(v, original[i]);
                            for (int r=1 ;; r++) {
                                int x = (i&-i)>>>r;
                                if (x == 0) break;
                                int child = i+x;
                                if (child > n+1) break;
                                v = Math.min(v, topDown[child]);
                            }
                        } else break;
                    }
                    if (v == topDown[i]) break;
                    topDown[i] = v;
                    i -= (i&-i);
                }
            }

            public long getMin(int a, int b) {
                long min = original[a];
                int prev = a;
                int curr = prev + (prev&-prev); // parent right hand side
                while (curr <= b) {
                    min = Math.min(min, topDown[prev]); // value from the other tree
                    prev = curr;
                    curr = prev + (prev&-prev);;
                }
                min = Math.min(min, original[prev]);
                prev = b;
                curr = prev - (prev&-prev); // parent left hand side
                while (curr >= a) {
                    min = Math.min(min,bottomUp[prev]); // value from the other tree
                    prev = curr;
                    curr = prev - (prev&-prev);
                }
                return min;
            }

        }

        class FenwickSum {
            public long[] d;

            public FenwickSum(int n) {
                d=new long[n+1];
            }

            /** a[0] must be unused. */
            public FenwickSum(long[] a) {
                d=new long[a.length];
                for (int i=1; i<a.length; i++) {
                    modify(i, a[i]);
                }
            }

            /** Do not modify i=0. */
            void modify(int i, long v) {
                while (i<d.length) {
                    d[i] += v;
                    // Move to next uplink on the RIGHT side of i
                    i += (i&-i);
                }
            }

            /** Returns sum from a to b, *BOTH* inclusive. */
            long getSum(int a, int b) {
                return getSum(b) - getSum(a-1);
            }

            private long getSum(int i) {
                long sum = 0;
                while (i>0) {
                    sum += d[i];
                    // Move to next uplink on the LEFT side of i
                    i -= (i&-i);
                }
                return sum;
            }
        }

        class SegmentTree {
            /** Query sums with log(n) modifyRange */
            int N;
            long[] p;

            public SegmentTree(int n) {
                /* TODO: Test that this works. */
                for (N=2; N<n; N++) N *= 2;
                p = new long[2*N];
            }

            public void modifyRange(int a, int b, long change) {
                muuta(a, change);
                muuta(b+1, -change);
            }

            void muuta(int k, long muutos) {
                k += N;
                p[k] += muutos;
                for (k /= 2; k >= 1; k /= 2) {
                    p[k] = p[2*k] + p[2*k+1];
                }
            }

            public long get(int k) {
                int a = N;
                int b = k+N;
                long s = 0;
                while (a <= b) {
                    if (a%2 == 1) s += p[a++];
                    if (b%2 == 0) s += p[b--];
                    a /= 2;
                    b /= 2;
                }
                return s;
            }

        }

        /***************************** Graphs *****************************/

        List<Integer>[] toGraph(IO io, int n) {
            List<Integer>[] g = new ArrayList[n+1];
            for (int i=1; i<=n; i++) g[i] = new ArrayList<>();
            for (int i=1; i<=n-1; i++) {
                int a = io.nextInt();
                int b = io.nextInt();
                g[a].add(b);
                g[b].add(a);
            }
            return g;
        }

        class Graph {
            HashMap<Long, List<Long>> edges;

            public Graph() {
                edges = new HashMap<>();
            }

            List<Long> getSetNeighbors(Long node) {
                List<Long> neighbors = edges.get(node);
                if (neighbors == null) {
                    neighbors = new ArrayList<>();
                    edges.put(node, neighbors);
                }
                return neighbors;
            }

            void addBiEdge(Long a, Long b) {
                addEdge(a, b);
                addEdge(b, a);
            }

            void addEdge(Long from, Long to) {
                getSetNeighbors(to); // make sure all have initialized lists
                List<Long> neighbors = getSetNeighbors(from);
                neighbors.add(to);
            }

            // topoSort variables
            int UNTOUCHED = 0;
            int FINISHED = 2;
            int INPROGRESS = 1;
            HashMap<Long, Integer> vis;
            List<Long> topoAns;
            List<Long> failDueToCycle = new ArrayList<Long>() {{ add(-1L); }};

            List<Long> topoSort() {
                topoAns = new ArrayList<>();
                vis = new HashMap<>();
                for (Long a : edges.keySet()) {
                    if (!topoDFS(a)) return failDueToCycle;
                }
                Collections.reverse(topoAns);
                return topoAns;
            }

            boolean topoDFS(long curr) {
                Integer status = vis.get(curr);
                if (status == null) status = UNTOUCHED;
                if (status == FINISHED) return true;
                if (status == INPROGRESS) {
                    return false;
                }
                vis.put(curr, INPROGRESS);
                for (long next : edges.get(curr)) {
                    if (!topoDFS(next)) return false;
                }
                vis.put(curr, FINISHED);
                topoAns.add(curr);
                return true;
            }

        }

        public class StronglyConnectedComponents {

            /** Kosaraju's algorithm */

            ArrayList<Integer>[] forw;
            ArrayList<Integer>[] bacw;

            /** Use: getCount(2, new int[] {1,2}, new int[] {2,1}) */
            public int getCount(int n, int[] mista, int[] minne) {
                forw = new ArrayList[n+1];
                bacw = new ArrayList[n+1];
                for (int i=1; i<=n; i++) {
                    forw[i] = new ArrayList<Integer>();
                    bacw[i] = new ArrayList<Integer>();
                }
                for (int i=0; i<mista.length; i++) {
                    int a = mista[i];
                    int b = minne[i];
                    forw[a].add(b);
                    bacw[b].add(a);
                }
                int count = 0;
                List<Integer> list = new ArrayList<Integer>();
                boolean[] visited = new boolean[n+1];
                for (int i=1; i<=n; i++) {
                    dfsForward(i, visited, list);
                }
                visited = new boolean[n+1];
                for (int i=n-1; i>=0; i--) {
                    int node = list.get(i);
                    if (visited[node]) continue;
                    count++;
                    dfsBackward(node, visited);
                }
                return count;
            }

            public void dfsForward(int i, boolean[] visited, List<Integer> list) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : forw[i]) {
                    dfsForward(neighbor, visited, list);
                }
                list.add(i);
            }

            public void dfsBackward(int i, boolean[] visited) {
                if (visited[i]) return;
                visited[i] = true;
                for (int neighbor : bacw[i]) {
                    dfsBackward(neighbor, visited);
                }
            }
        }

        class LCAFinder {

            /* O(n log n) Initialize: new LCAFinder(graph)
             * O(log n) Queries: find(a,b) returns lowest common ancestor for nodes a and b */

            int[] nodes;
            int[] depths;
            int[] entries;
            int pointer;
            FenwickMin fenwick;

            public LCAFinder(List<Integer>[] graph) {
                this.nodes = new int[(int)10e6];
                this.depths = new int[(int)10e6];
                this.entries = new int[graph.length];
                this.pointer = 1;
                boolean[] visited = new boolean[graph.length+1];
                dfs(1, 0, graph, visited);
                fenwick = new FenwickMin(pointer-1);
                for (int i=1; i<pointer; i++) {
                    fenwick.set(i, depths[i] * 1000000L + i);
                }
            }

            private void dfs(int node, int depth, List<Integer>[] graph, boolean[] visited) {
                visited[node] = true;
                entries[node] = pointer;
                nodes[pointer] = node;
                depths[pointer] = depth;
                pointer++;
                for (int neighbor : graph[node]) {
                    if (visited[neighbor]) continue;
                    dfs(neighbor, depth+1, graph, visited);
                    nodes[pointer] = node;
                    depths[pointer] = depth;
                    pointer++;
                }
            }

            public int find(int a, int b) {
                int left = entries[a];
                int right = entries[b];
                if (left > right) {
                    int temp = left;
                    left = right;
                    right = temp;
                }
                long mixedBag = fenwick.getMin(left, right);
                int index = (int) (mixedBag % 1000000L);
                return nodes[index];
            }
        }

        /**************************** Geometry ****************************/

        class Point {
            int y;
            int x;

            public Point(int y, int x) {
                this.y = y;
                this.x = x;
            }
        }

        boolean segmentsIntersect(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) {
            // Returns true if segment 1-2 intersects segment 3-4

            if (x1 == x2 && x3 == x4) {
                // Both segments are vertical
                if (x1 != x3) return false;
                if (min(y1,y2) < min(y3,y4)) {
                    return max(y1,y2) >= min(y3,y4);
                } else {
                    return max(y3,y4) >= min(y1,y2);
                }
            }
            if (x1 == x2) {
                // Only segment 1-2 is vertical. Does segment 3-4 cross it? y = a*x + b
                double a34 = (y4-y3)/(x4-x3);
                double b34 = y3 - a34*x3;
                double y = a34 * x1 + b34;
                return y >= min(y1,y2) && y <= max(y1,y2) && x1 >= min(x3,x4) && x1 <= max(x3,x4);
            }
            if (x3 == x4) {
                // Only segment 3-4 is vertical. Does segment 1-2 cross it? y = a*x + b
                double a12 = (y2-y1)/(x2-x1);
                double b12 = y1 - a12*x1;
                double y = a12 * x3 + b12;
                return y >= min(y3,y4) && y <= max(y3,y4) && x3 >= min(x1,x2) && x3 <= max(x1,x2);
            }
            double a12 = (y2-y1)/(x2-x1);
            double b12 = y1 - a12*x1;
            double a34 = (y4-y3)/(x4-x3);
            double b34 = y3 - a34*x3;
            if (closeToZero(a12 - a34)) {
                // Parallel lines
                return closeToZero(b12 - b34);
            }
            // Non parallel non vertical lines intersect at x. Is x part of both segments?
            double x = -(b12-b34)/(a12-a34);
            return x >= min(x1,x2) && x <= max(x1,x2) && x >= min(x3,x4) && x <= max(x3,x4);
        }

        boolean pointInsideRectangle(Point p, List<Point> r) {
            Point a = r.get(0);
            Point b = r.get(1);
            Point c = r.get(2);
            Point d = r.get(3);
            double apd = areaOfTriangle(a, p, d);
            double dpc = areaOfTriangle(d, p, c);
            double cpb = areaOfTriangle(c, p, b);
            double pba = areaOfTriangle(p, b, a);
            double sumOfAreas = apd + dpc + cpb + pba;
            if (closeToZero(sumOfAreas - areaOfRectangle(r))) {
                if (closeToZero(apd) || closeToZero(dpc) || closeToZero(cpb) || closeToZero(pba)) {
                    return false;
                }
                return true;
            }
            return false;
        }

        double areaOfTriangle(Point a, Point b, Point c) {
            return 0.5 * Math.abs((a.x-c.x)*(b.y-a.y)-(a.x-b.x)*(c.y-a.y));
        }

        double areaOfRectangle(List<Point> r) {
            double side1xDiff = r.get(0).x - r.get(1).x;
            double side1yDiff = r.get(0).y - r.get(1).y;
            double side2xDiff = r.get(1).x - r.get(2).x;
            double side2yDiff = r.get(1).y - r.get(2).y;
            double side1 = Math.sqrt(side1xDiff * side1xDiff + side1yDiff * side1yDiff);
            double side2 = Math.sqrt(side2xDiff * side2xDiff + side2yDiff * side2yDiff);
            return side1 * side2;
        }

        boolean pointsOnSameLine(double x1, double y1, double x2, double y2, double x3, double y3) {
            double areaTimes2 = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
            return (closeToZero(areaTimes2));
        }

        class PointToLineSegmentDistanceCalculator {

            // Just call this
            double minDistFromPointToLineSegment(double point_x, double point_y, double x1, double y1, double x2, double y2) {
                return Math.sqrt(distToSegmentSquared(point_x, point_y, x1, y1, x2, y2));
            }

            private double distToSegmentSquared(double point_x, double point_y, double x1, double y1, double x2, double y2) {
                double l2 = dist2(x1,y1,x2,y2);
                if (l2 == 0) return dist2(point_x, point_y, x1, y1);
                double t = ((point_x - x1) * (x2 - x1) + (point_y - y1) * (y2 - y1)) / l2;
                if (t < 0) return dist2(point_x, point_y, x1, y1);
                if (t > 1) return dist2(point_x, point_y, x2, y2);

                double com_x = x1 + t * (x2 - x1);
                double com_y = y1 + t * (y2 - y1);
                return dist2(point_x, point_y, com_x, com_y);
            }

            private double dist2(double x1, double y1, double x2, double y2) {
                return Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2);
            }

        }

        /****************************** Math ******************************/

        long pow(long base, int exp) {
            if (exp == 0) return 1L;
            long x = pow(base, exp/2);
            long ans = x * x;
            if (exp % 2 != 0) ans *= base;
            return ans;
        }

        int[] generatePrimesUpTo(int last) {
            /* Sieve of Eratosthenes. Practically O(n). Values of 0 indicate primes. */
            int[] div = new int[last+1];
            for (int x=2; x<=last; x++) {
                if (div[x] > 0) continue;
                for (int u=2*x; u<=last; u+=x) {
                    div[u] = x;
                }
            }
            return div;
        }

        class BaseConverter {

            /* Palauttaa luvun esityksen kannassa base */
            public String convert(Long number, int base) {
                return Long.toString(number, base);
            }

            /* Palauttaa luvun esityksen kannassa baseTo, kun annetaan luku Stringinä kannassa baseFrom */
            public String convert(String number, int baseFrom, int baseTo) {
                return Long.toString(Long.parseLong(number, baseFrom), baseTo);
            }

            /* Tulkitsee kannassa base esitetyn luvun longiksi (kannassa 10) */
            public long longify(String number, int baseFrom) {
                return Long.parseLong(number, baseFrom);
            }
        }

        class BinomialCoefficients {
            /** Total number of K sized unique combinations from pool of size N (unordered)
             N! / ( K! (N - K)! )   */

            /** For simple queries where output fits in long. */
            public long biCo(long n, long k) {
                long r = 1;
                if (k > n) return 0;
                for (long d = 1; d <= k; d++) {
                    r *= n--;
                    r /= d;
                }
                return r;
            }

            /** For multiple queries with same n, different k. */
            public long[] precalcBinomialCoefficientsK(int n, int maxK) {
                long v[] = new long[maxK+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,maxK); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                    }
                }
                return v;
            }

            /** When output needs % MOD. */
            public long[] precalcBinomialCoefficientsK(int n, int k, long M) {
                long v[] = new long[k+1];
                v[0] = 1; // nC0 == 1
                for (int i=1; i<=n; i++) {
                    for (int j=Math.min(i,k); j>0; j--) {
                        v[j] = v[j] + v[j-1]; // Pascal's triangle
                        v[j] %= M;
                    }
                }
                return v;
            }
        }

        /**************************** Strings ****************************/

        class Zalgo {

            public int pisinEsiintyma(String haku, String kohde) {
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                int max = 0;
                for (int i=haku.length(); i<z.length; i++) {
                    max = Math.max(max, z[i]);
                }
                return max;
            }

            public int[] toZarray(char[] s) {
                int n = s.length;
                int[] z = new int[n];
                int a = 0, b = 0;
                for (int i = 1; i < n; i++) {
                    if (i > b) {
                        for (int j = i; j < n && s[j - i] == s[j]; j++)  z[i]++;
                    }
                    else {
                        z[i] = z[i - a];
                        if (i + z[i - a] > b) {
                            for (int j = b + 1; j < n && s[j - i] == s[j]; j++) z[i]++;
                            a = i;
                            b = i + z[i] - 1;
                        }
                    }
                }
                return z;
            }

            public List<Integer> getStartIndexesWhereWordIsFound(String haku, String kohde) {
                // this is alternative use case
                char[] s = new char[haku.length() + 1 + kohde.length()];
                for (int i=0; i<haku.length(); i++) {
                    s[i] = haku.charAt(i);
                }
                int j = haku.length();
                s[j++] = '#';
                for (int i=0; i<kohde.length(); i++) {
                    s[j++] = kohde.charAt(i);
                }
                int[] z = toZarray(s);
                List<Integer> indexes = new ArrayList<>();
                for (int i=haku.length(); i<z.length; i++) {
                    if (z[i] < haku.length()) continue;
                    indexes.add(i);
                }
                return indexes;
            }

        }

        class StringHasher {

            class HashedString {
                long[] hashes;
                long[] modifiers;

                public HashedString(long[] hashes, long[] modifiers) {
                    this.hashes = hashes;
                    this.modifiers = modifiers;
                }
            }

            long P;
            long M;

            public StringHasher() {
                initializePandM();
            }

            HashedString hashString(String s) {
                int n = s.length();
                long[] hashes = new long[n];
                long[] modifiers = new long[n];
                hashes[0] = s.charAt(0);
                modifiers[0] = 1;
                for (int i=1; i<n; i++) {
                    hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    modifiers[i] = (modifiers[i-1] * P) % M;
                }
                return new HashedString(hashes, modifiers);
            }

            /**
             * Indices are inclusive.
             */
            long getHash(HashedString hashedString, int startIndex, int endIndex) {
                long[] hashes = hashedString.hashes;
                long[] modifiers = hashedString.modifiers;
                long result = hashes[endIndex];
                if (startIndex > 0) result -= (hashes[startIndex-1] * modifiers[endIndex-startIndex+1]) % M;
                if (result < 0) result += M;
                return result;
            }

            // Less interesting methods below

            /**
             * Efficient for 2 input parameter strings in particular.
             */
            HashedString[] hashString(String first, String second) {
                HashedString[] array = new HashedString[2];
                int n = first.length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;

                long[] firstHashes = new long[n];
                firstHashes[0] = first.charAt(0);
                array[0] = new HashedString(firstHashes, modifiers);

                long[] secondHashes = new long[n];
                secondHashes[0] = second.charAt(0);
                array[1] = new HashedString(secondHashes, modifiers);

                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    firstHashes[i] = (firstHashes[i-1] * P + first.charAt(i)) % M;
                    secondHashes[i] = (secondHashes[i-1] * P + second.charAt(i)) % M;
                }
                return array;
            }

            /**
             * Efficient for 3+ strings
             * More efficient than multiple hashString calls IF strings are same length.
             */
            HashedString[] hashString(String... strings) {
                HashedString[] array = new HashedString[strings.length];
                int n = strings[0].length();
                long[] modifiers = new long[n];
                modifiers[0] = 1;
                for (int j=0; j<strings.length; j++) {
                    // if all strings are not same length, defer work to another method
                    if (strings[j].length() != n) {
                        for (int i=0; i<n; i++) {
                            array[i] = hashString(strings[i]);
                        }
                        return array;
                    }

                    // otherwise initialize stuff
                    long[] hashes = new long[n];
                    hashes[0] = strings[j].charAt(0);
                    array[j] = new HashedString(hashes, modifiers);
                }
                for (int i=1; i<n; i++) {
                    modifiers[i] = (modifiers[i-1] * P) % M;
                    for (int j=0; j<strings.length; j++) {
                        String s = strings[j];
                        long[] hashes = array[j].hashes;
                        hashes[i] = (hashes[i-1] * P + s.charAt(i)) % M;
                    }
                }
                return array;
            }

            void initializePandM() {
                ArrayList<Long> modOptions = new ArrayList<>(20);
                modOptions.add(353873237L);
                modOptions.add(353875897L);
                modOptions.add(353878703L);
                modOptions.add(353882671L);
                modOptions.add(353885303L);
                modOptions.add(353888377L);
                modOptions.add(353893457L);
                P = modOptions.get(new Random().nextInt(modOptions.size()));

                modOptions.clear();
                modOptions.add(452940277L);
                modOptions.add(452947687L);
                modOptions.add(464478431L);
                modOptions.add(468098221L);
                modOptions.add(470374601L);
                modOptions.add(472879717L);
                modOptions.add(472881973L);
                M = modOptions.get(new Random().nextInt(modOptions.size()));

            }
        }

        /*************************** Technical ***************************/

        private class IO extends PrintWriter {
            private InputStreamReader r;
            private static final int BUFSIZE = 1 << 15;
            private char[] buf;
            private int bufc;
            private int bufi;
            private StringBuilder sb;

            public IO() {
                super(new BufferedOutputStream(System.out));
                r = new InputStreamReader(System.in);

                buf = new char[BUFSIZE];
                bufc = 0;
                bufi = 0;
                sb = new StringBuilder();
            }

            /** Print, flush, return nextInt. */
            private int queryInt(String s) {
                io.println(s);
                io.flush();
                return nextInt();
            }

            /** Print, flush, return nextLong. */
            private long queryLong(String s) {
                io.println(s);
                io.flush();
                return nextLong();
            }

            /** Print, flush, return next word. */
            private String queryNext(String s) {
                io.println(s);
                io.flush();
                return next();
            }

            private void fillBuf() throws IOException {
                bufi = 0;
                bufc = 0;
                while(bufc == 0) {
                    bufc = r.read(buf, 0, BUFSIZE);
                    if(bufc == -1) {
                        bufc = 0;
                        return;
                    }
                }
            }

            private boolean pumpBuf() throws IOException {
                if(bufi == bufc) {
                    fillBuf();
                }
                return bufc != 0;
            }

            private boolean isDelimiter(char c) {
                return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
            }

            private void eatDelimiters() throws IOException {
                while(true) {
                    if(bufi == bufc) {
                        fillBuf();
                        if(bufc == 0) throw new RuntimeException("IO: Out of input.");
                    }

                    if(!isDelimiter(buf[bufi])) break;
                    ++bufi;
                }
            }

            public String next() {
                try {
                    sb.setLength(0);

                    eatDelimiters();
                    int start = bufi;

                    while(true) {
                        if(bufi == bufc) {
                            sb.append(buf, start, bufi - start);
                            fillBuf();
                            start = 0;
                            if(bufc == 0) break;
                        }

                        if(isDelimiter(buf[bufi])) break;
                        ++bufi;
                    }

                    sb.append(buf, start, bufi - start);

                    return sb.toString();
                } catch(IOException e) {
                    throw new RuntimeException("IO.next: Caught IOException.");
                }
            }

            public int nextInt() {
                try {
                    int ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
                            ret *= 10;
                            ret -= (int)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
                        } else {
                            throw new RuntimeException("IO.nextInt: Invalid int.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextInt: Caught IOException.");
                }
            }

            public long nextLong() {
                try {
                    long ret = 0;

                    eatDelimiters();

                    boolean positive = true;
                    if(buf[bufi] == '-') {
                        ++bufi;
                        if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
                        positive = false;
                    }

                    boolean first = true;
                    while(true) {
                        if(!pumpBuf()) break;
                        if(isDelimiter(buf[bufi])) {
                            if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
                            break;
                        }
                        first = false;

                        if(buf[bufi] >= '0' && buf[bufi] <= '9') {
                            if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
                            ret *= 10;
                            ret -= (long)(buf[bufi] - '0');
                            if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
                        } else {
                            throw new RuntimeException("IO.nextLong: Invalid long.");
                        }

                        ++bufi;
                    }

                    if(positive) {
                        if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
                        ret = -ret;
                    }

                    return ret;
                } catch(IOException e) {
                    throw new RuntimeException("IO.nextLong: Caught IOException.");
                }
            }

            public double nextDouble() {
                return Double.parseDouble(next());
            }

        }

        void print(Object output) {
            io.println(output);
        }

        void done(Object output) {
            print(output);
            done();
        }

        void done() {
            io.close();
            throw new RuntimeException("Clean exit");
        }

        long min(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        double min(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        int min(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.min(ans, v[i]);
            }
            return ans;
        }

        long max(long... v) {
            long ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        double max(double... v) {
            double ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

        int max(int... v) {
            int ans = v[0];
            for (int i=1; i<v.length; i++) {
                ans = Math.max(ans, v[i]);
            }
            return ans;
        }

    }

}

import java.util.*;
import java.io.*;

   public class x992B
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int L = Integer.parseInt(st.nextToken());
         int R = Integer.parseInt(st.nextToken());
         int X = Integer.parseInt(st.nextToken());
         int Y = Integer.parseInt(st.nextToken());
         //
         if(Y%X != 0)
         {
            System.out.println(0);
            return;
         }
         int res = 0;
         int boof = Y/X;
         for(int i=1; i < Math.sqrt(boof); i++)
         {
            if(boof%i == 0 && Math.min(i, boof/i) >= L && Math.max(i, boof/i) <= R)
               if(rp(i, boof/i))
                  res++;
         }
         res *= 2;
         System.out.println(res);
      }
      public static boolean rp(int a, int b)
      {
         if(b > a)
         {
            int t = a;
            a = b;
            b = t;
         }
         if(b == 0)
            return a == 1;
         return rp(b, a%b);
      }
   }

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Integer.parseInt(st.nextToken());
        long r = Integer.parseInt(st.nextToken());
        long gcd = Integer.parseInt(st.nextToken());
        long lcm = Integer.parseInt(st.nextToken());
        long n = gcd*lcm;
        ArrayList<Long> list = trial_division(n);
        long res = 0;
        for (long i : list) {
            long j = n/i;
            if (j == 1 || i == 1) {
                continue;
            }
            if (i >= l && i <= r) {
                if (gcd(i,j) != gcd) {
                    continue;
                }
                if (lcm(i, j) != lcm) {
                    continue;
                }
                if (i == j) {
                    res++;
                } else {
                    res += 2;
                }
            }
        }
        if (1 >= l && 1 <= r && n >= l && n <= r) {
            if (1 == n) {
                res++;
            } else {
                res += 2;
            }
        }
        System.out.println(res);
    }
    static long gcd(long p, long q) {
        if (q == 0) return p;
        else return gcd(q, p % q);
    }
    static long lcm(long a, long b) {
        return (a*b)/(gcd(a,b));
    }
    static ArrayList<Long> trial_division(long n) {
        ArrayList<Long> factorization = new ArrayList<>();
        for (int d : new int[]{2, 3, 5}) {
            while (n % d == 0) {
                factorization.add((long) d);
                n /= d;
            }
        }
        int[] increments = {4, 2, 4, 2, 4, 6, 2, 6};
        int i = 0;
        for (long d = 7; d * d <= n; d += increments[i++]) {
            while (n % d == 0) {
                factorization.add(d);
                n /= d;
            }
            if (i == 8)
                i = 0;
        }
        if (n > 1)
            factorization.add(n);
        return factorization;
    }
}
/*

 */

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class TryB
{

    static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;

		public InputReader(InputStream st) {
			this.stream = st;
		}

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}

		public String rs() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

    static long mod=1000000007;
    static BigInteger bigInteger = new BigInteger("1000000007");
    static int n = (int)1e6;
    static boolean[] prime;
    static ArrayList<Long> as;
    static void sieve() {
			Arrays.fill(prime	, true);
			prime[0] = prime[1] = false;
			for(int i = 2 ; i * i <= n ; ++i) {
				if(prime[i]) {
					for(int k = i * i; k< n ; k+=i) {
						prime[k] = false;
					}
				}
			}

		}
		static PrintWriter w = new PrintWriter(System.out);

    public static void main(String[] args)
    {

        InputReader sc = new InputReader(System.in);
        //PrintWriter w = new PrintWriter(System.out);

       /*
        prime  = new boolean[n + 1];
		sieve();
		prime[1] = false;
		*/
		/*
		as = new ArrayList<>();
		for(int i=2;i<=1000000;i++)
		{
		    if(prime[i])
		    as.add(i);
		}
		*/

       /*

	long a = sc.nl();

            BigInteger ans = new BigInteger("1");
            for (long i = 1; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    if (a / i == i) {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));

                    } else {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        ans = ans.multiply(BigInteger.valueOf(phi(a / i)));

                    }

                }
            }
            w.println(ans.mod(bigInteger));
            */

      long l = sc.nl();
      long r = sc.nl();
      long x = sc.nl();
      long y = sc.nl();
      long p = x*y;
      primeFactors(p,x,y);
      /*
      for(int i=0;i<as.size();i++)
      {
          w.print(as.get(i) +" ");
      }
      */
      long res = 0;
      for(int i=0;i<as.size();i++)
      {
          if(as.get(i) >= l && as.get(i) <= r)
          {
              long te = p/as.get(i);

              if(p%as.get(i) == 0)
              {
                  if(te >=l && te <= r)
                  {
                      if(gcd(te, as.get(i)) == x)
                      {
                      if(te == as.get(i) || as.contains(te))
                          res++;
                      else
                          res += 2;
                      }
                  }
              }

          }
      }
      w.println(res);

      w.close();

    }
    static int opens(String p)
    {
        int c = 0;
        for(int i=0;i<p.length();i++)
        {
            if(p.charAt(i) == '(')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
    static int closes(String p)
    {
        int c = 0;
        for(int i=p.length()-1;i>=0;i--)
        {
            if(p.charAt(i) == ')')
            {
                c++;
            }
            else
            {
                c--;
                if(c < 0)
                    return -1;
            }
        }
        return c;
    }
     static long modexp(long x,long n,long M)
{
    long power = n;
    long result=1;
    while(power>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        power = power/2;
    }
    return result;
}
     static long modInverse(long A,long M)
{
    return modexp(A,M-2,M);
}

     public static long modMultiply(long one, long two) {

		return (one % mod * two % mod) % mod;
	}
    static long fx(int m)
    {
        long re = 0;
        for(int i=1;i<=m;i++)
        {
            re += (long) (i / gcd(i,m));
        }
        return re;
    }
     static long gcd(long a, long b)
    {
	 if (a == 0)
	  return b;

	return gcd(b%a, a);
    }
     static long lcm(long a, long b)
    {
	 return (a*b)/gcd(a, b);
    }

     static long phi(long nx)
    {
        // Initialize result as n
        double result = nx;

        // Consider all prime factors of n and for
        // every prime factor p, multiply result
        // with (1 - 1/p)
        for (int p = 0; as.get(p) * as.get(p) <= nx; ++p)
        {
            // Check if p is a prime factor.
            if (nx % as.get(p) == 0)
            {
                // If yes, then update n and result
                while (nx % as.get(p) == 0)
                    nx /= as.get(p);
                result *= (1.0 - (1.0 / (double) as.get(p)));
            }
        }

        // If n has a prime factor greater than sqrt(n)
        // (There can be at-most one such prime factor)
        if (nx > 1)
            result *= (1.0 - (1.0 / (double) nx));

        return (long)result;

        //return(phi((long)result,k-1));

    }

    public static void primeFactors(long n,long c,long d)
    {
        long sum = 0;
        // Print the number of 2s that divide n
        as = new ArrayList<>();
       if(d%n == 0)
            as.add(n);
        while (n%2==0)
        {
            sum = 1;
            //System.out.print(2 + " ");
            n /= 2;
            if(d%n == 0)
            as.add(n);
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (long i = 3; i <= (long)Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n

            while (n%i == 0)
            {

               // System.out.print(i + " ");
                if(d%n == 0)
                as.add(n);
                n /= i;

            }
            sum++;
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2

    }
    static int digitsum(int x)

    {

        int sum = 0;
        while(x > 0)
        {
            int temp = x % 10;
            sum += temp;
            x /= 10;
        }
        return sum;

    }
    static int countDivisors(int n)
    {
        int cnt = 0;
        for (int i = 1; i*i <=n; i++)
        {
             if (n % i == 0 && i<=1000000)
             {
                // If divisors are equal,
                // count only one
                if (n / i == i)
                   cnt++;

                else // Otherwise count both
                    cnt = cnt + 2;
             }
         }
        return cnt;
    }

    static boolean isprime(int n)
    {

    if(n == 2)
        return true;
    if(n == 3)
        return true;
    if(n % 2 == 0)
        return false;
    if(n % 3 == 0)
        return false;

    int i = 5;
   int w = 2;

    while(i * i <= n)
    {
        if(n % i == 0)
            return false;

        i += w;
        w = 6 - w;
    }

    return true;
    }

    static long log2(long value) {
    return Long.SIZE-Long.numberOfLeadingZeros(value);
}

    static boolean binarysearch(int []arr,int p,int n)
    {
        //ArrayList<Integer> as = new ArrayList<>();
        //as.addAll(0,at);
        //Collections.sort(as);
        boolean re = false;
        int st = 0;
        int end = n-1;

        while(st <= end)
        {
            int mid = st + (end-st)/2;

            if(p > arr[mid])
            {
                st = mid+1;

            }
            else if(p < arr[mid])
            {
                end = mid-1;

            }
            else if(p == arr[mid])
            {

            re = true;
            break;
            }

        }
         return re;

    }

    static class Student
    {

        int position;
        int value;
        Student(int position,int value)
        {
            this.position = position;
            this.value = value;

        }

    }
    /* Java program for Merge Sort */
static class MergeSort
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int [n1];
        int R[] = new int [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

    /* A utility function to print array of size n */

}

    public static int ip(String s){
		return Integer.parseInt(s);
	}
	 public static String ips(int s){
		return Integer.toString(s);
	}

}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Integer.parseInt(st.nextToken());
        long r = Integer.parseInt(st.nextToken());
        long gcd = Integer.parseInt(st.nextToken());
        long lcm = Integer.parseInt(st.nextToken());
        long n = gcd*lcm;
        ArrayList<Long> list = trial_division(n);
        long res = 0;
        for (long i : list) {
            long j = n/i;
            if (i >= l && i <= r) {
                if (gcd(i,j) != gcd) {
                    continue;
                }
                if (lcm(i, j) != lcm) {
                    continue;
                }
                if (i == j) {
                    res++;
                } else {
                    res += 2;
                }
            }
        }
        if (1 >= l && 1 <= r && n >= l && n <= r) {
            if (1 == n) {
                res++;
            } else {
                res += 2;
            }
        }
        System.out.println(res);
    }
    static long gcd(long p, long q) {
        if (q == 0) return p;
        else return gcd(q, p % q);
    }
    static long lcm(long a, long b) {
        return (a*b)/(gcd(a,b));
    }
    static ArrayList<Long> trial_division(long n) {
        ArrayList<Long> factorization = new ArrayList<>();
        for (int d : new int[]{2, 3, 5}) {
            while (n % d == 0) {
                factorization.add((long) d);
                n /= d;
            }
        }
        int[] increments = {4, 2, 4, 2, 4, 6, 2, 6};
        int i = 0;
        for (long d = 7; d * d <= n; d += increments[i++]) {
            while (n % d == 0) {
                factorization.add(d);
                n /= d;
            }
            if (i == 8)
                i = 0;
        }
        if (n > 1)
            factorization.add(n);
        return factorization;
    }
}
/*

 */

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt();
		int r=sc.nextInt();
		int g=sc.nextInt();
		int lc=sc.nextInt();
		//System.out.println(lc);
		ArrayList<Integer> a=new ArrayList<Integer> ();
		for (int i=1; i<=Math.sqrt(lc); i++)
        {
            if (lc%i==0)
            {
                if (lc/i == i&&i%g==0&&i>=l&&i<=r)
                    a.add(i);

                else if(lc/i != i)
                {
                		if(i%g==0&&i>=l&&i<=r)
                		a.add(i);
                		if((lc/i)%g==0&&(lc/i)>=l&&(lc/i)<=r)
                		a.add(lc/i);

                }
            }
        }
        //System.out.println(a);
        int c=0;
        for(int i=0;i<a.size();i++)
        {
        	for(int j=i+1;j<a.size();j++)
        	{
        		long gc=(long)gcd(a.get(i),a.get(j));
        		long lcm=(long)((a.get(i)/g)*a.get(j));
                	if(gc==(long)(g)&&lcm==(long)(lc))
                	{
                		++c;
                	}
        }
        }
        if(lc%g != 0)
		{
		System.out.println("0");
		}
        else if(a.size()==1)
        {
        	if(a.get(0)==lc&&1>=l)
        	{
        			System.out.println("1");
        	}
        	else
        	System.out.println("0");
        }

        else
        System.out.println(c*2);
	}
	public static int gcd(int a,int b)
	{
		if (b == 0)
    		return a;
    	return gcd(b, a % b);
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class prog_A {
	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int l = in.nextInt();
		int r = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt() / x;
		int ans = 0;
		for (int i = 1; i * i <= y; i++) {
			if (y % i == 0) {
				int a = i;
				int b = y / i;
				if (gcd(a, b) == 1) {
					if (l <= Math.min(a, b) * x && Math.max(a, b) * x <= r)
						ans += 2;
				}
			}
		}
		out.println(ans);
		in.close();
		out.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ijxjdjd
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();
            long com = x * y;
            int res = 0;
            for (long i = l; i <= r; i++) {
                if (com % i == 0) {
                    res++;
                }
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            long[] d = in.getALineOfLong(4);
            long l = d[0];
            long r = d[1];
            long x = d[2];
            long y = d[3];

            if (y % x != 0 || gcd(y / x, x) != 1) {
                out.println(0);
                return;
            }

            long res = 0;
            long withoutGCD = y / x;
            for (long i = l; i < r && i * i < withoutGCD; i++) {
                if (withoutGCD % i == 0 && withoutGCD / i <= r && gcd(withoutGCD / i, i) == 1) {
                    res += 2;
                }
            }

            out.println(res);
        }

        private long gcd(long a, long b) {
            if (b == 0)
                return a;

            return gcd(b, a % b);
        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public MyBufferedReader(BufferedReader in) {
            this.in = in;
        }

        public long[] getALineOfLong(int numExpected) {
            if (numExpected == 0) {
                return new long[0];
            }

            long[] res = new long[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Long.parseLong(st.nextToken());
            return res;
        }

    }
}

   // package com.company;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.reflect.Array;
    import java.util.*;
    public class Main {

        public static void main(String[] args) throws IOException {
            Scanner s = new Scanner(System.in);
         //   BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
             StringBuilder sb = new StringBuilder();
            long l=s.nextLong();
            long r=s.nextLong();
            long x=s.nextLong();
            long y=s.nextLong();
            long p=x*y;long ans=0;
            for(long i=l;i<=Math.sqrt(y);i++){
                if(p%i==0&&p/i<=r&&(i*(p/i)/gcd((int)i,(int)(p/i))==y)&&gcd((int)i,(int)(p/i))==x){
                 //   System.out.println(":HI");
                    if(i!=p/i)
                    ans+=2;else ans+=1;
                }
            }
            System.out.println(ans);
        }
         static double power(double x, long y, int p) {
            double res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }
        public static void fracion(double x) {
            String a = "" + x;
            String spilts[] = a.split("\\."); // split using decimal
            int b = spilts[1].length(); // find the decimal length
            int denominator = (int) Math.pow(10, b); // calculate the denominator
            int numerator = (int) (x * denominator); // calculate the nerumrator Ex
            // 1.2*10 = 12
            int gcd = gcd(numerator, denominator); // Find the greatest common
            // divisor bw them
            String fraction = "" + numerator / gcd + "/" + denominator / gcd;
            // System.out.println((denominator/gcd));
            long x1=modInverse(denominator / gcd,998244353  );
            //  System.out.println(x1);
            System.out.println((((numerator / gcd )%998244353 *(x1%998244353  ))%998244353  ) );
        }static int max=Integer.MIN_VALUE;
static int max1=Integer.MIN_VALUE;static int[] ans;static long[][] dp;static int[][] c;
        public static int dfs(int papa, int i, ArrayList<Integer>[] h, int[] vis) {

             vis[i] = 1;
               if(papa!=-1){
                   dp[i-1][0]=Math.min(dp[i-1][0],c[0][i-1]+Math.min(dp[papa-1][1],dp[papa-1][2]));
                   dp[i-1][1]=Math.min(dp[i-1][1],c[1][i-1]+Math.min(dp[papa-1][0],dp[papa-1][2]));
                   dp[i-1][2]=Math.min(dp[i-1][2],c[2][i-1]+Math.min(dp[papa-1][1],dp[papa-1][0]));

               }else{
                   dp[i-1][0]=c[i-1][0];
                   dp[i-1][1]=c[i-1][1];
                   dp[i-1][2]=c[i-1][2];

               }
             for(Integer j:h[i]){
                      if(vis[j]==0){
                          dfs(i,j,h,vis);
                      }
             }ans[i]+=1;if(ans[i]>max){
                 max=ans[i];max1=i;
            }
          return ans[i];
        }

        public static void bfs(int i, HashMap<Integer, Integer>[] h, int[] vis, int len, int papa) {
            Queue<Integer> q = new LinkedList<Integer>();
            q.add(i);

        }

        static int i(String a) {
            return Integer.parseInt(a);
        }

        static long l(String a) {
            return Long.parseLong(a);
        }

        static String[] inp() throws IOException {
            BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
            return s.readLine().trim().split("\\s+");
        }

        static int gcd(int a, int b) {
            if (b == 0)
                return a;
            return gcd(b, a % b);
        }
        static long modInverse(int a, int m)
        {

            {
                // If a and m are relatively prime, then modulo inverse
                // is a^(m-2) mode m
                return (power(a, m - 2, m));
            }
        }

        // To compute x^y under modulo m
        static long power(int x, int y, int m)
        {
            if (y == 0)
                return 1;

            long p = power(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

        // Function to return gcd of a and b

    }
    class Student
    {
        int l,r;

        public Student(int l, int r) {
            this.l = l;
            this.r = r;

        }
    // Constructor

        // Used to print student details in main()
        public String toString()
        {
            return this.l+" ";
        }
    }

    class Sortbyroll implements Comparator<Student>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Student a, Student b){
            return a.l-b.l;
        }
    }

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long x = in.nextLong();
            long k = in.nextLong();
            long max2 = (((x % 1_000_000_007) * (pb(k))) % 1_000_000_007) % 1_000_000_007;
            long min2 = ((((x - 1) % 1_000_000_007) * pb(k)) % 1_000_000_007 + 1) % 1_000_000_007;
            if (x == 0) min2 = 0;
            out.println((max2 + min2) % 1_000_000_007);
        }

        long pb(long a) {
            if (a == 0) return 1;
            if (a == 1) return 2;
            long tmp = pb(a / 2);
            if (a % 2 == 0) return (tmp * tmp) % 1_000_000_007;
            return (((tmp * tmp) % 1_000_000_007) * 2) % 1_000_000_007;
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class A {
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        long l = Reader.nextInt();
        long r = Reader.nextInt();
        long x = Reader.nextInt();
        long y = Reader.nextInt();
        long iii = x*y;
        long te = (long)Math.sqrt(iii);
        long count = 0;
        long L = (l + x -1)/x;
        long R = te/x;
        if(x != 1){
        for(long i = L; i <= R; i++){
            if(y%i == 0 && y/i <= R  &&gcd(i ,y/i) == 1){count++;}
        }
        }
        else{
            for(long i = L; i <= R; i++){
                if(y%i == 0 && y/i <= R && gcd(i ,y/i) == 1){count++;}
            }
        }
        if(te*te == iii && te == x) System.out.println(Math.max(count*2 - 1, 0));
        else  System.out.println(count*2);

    }

    static long gcd(long a, long b){
        if(a == 0){return b;}
        return gcd(b%a, a);
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");

    }

    static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());

            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            tokenizer = new StringTokenizer(

                    reader.readLine() );

        }
        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() {

        return Long.parseLong(nextToken());
    }
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;

public class Main {

	private static final int MAXN = 5000;
	private static final String NO = "NO";
	private static final String YES = "YES";
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	private static long MOD = 1000000009;

	void solve() {
		long l = nl();
		long r = nl();
		long gcd = nl();
		long lcm = nl();

		long m = lcm / gcd;

		int ans = 0;
		if (lcm % gcd == 0)
			for (int a = 1; a <= Math.sqrt(m); a++) {
				if (m % a == 0 && a * gcd <= r && a * gcd >= l && m / a * gcd <= r && m / a * gcd >= l
						&& gcd(a, m / a) == 1) {
//					tr(a * gcd, m / a * gcd, lcm, gcd, m);
					ans++;
				}
			}

		out.println(ans * 2);
	}

	long power(long a, long b) {
		long x = 1, y = a;
		while (b > 0) {
			if (b % 2 != 0) {
				x = (x * y) % MOD;
			}
			y = (y * y) % MOD;
			b /= 2;
		}
		return x % MOD;
	}

	private long gcd(long a, long b) {
		while (a != 0) {
			long tmp = b % a;
			b = a;
			a = tmp;
		}
		return b;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	private boolean vis[];

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[] na2(int n) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int[][] na(int n, int m) {
		int[][] a = new int[n][];
		for (int i = 0; i < n; i++)
			a[i] = na(m);
		return a;
	}

	private Integer[][] na2(int n, int m) {
		Integer[][] a = new Integer[n][];
		for (int i = 0; i < n; i++)
			a[i] = na2(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long[] nl(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {

    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        long l = scanner.nextLong();
        long r = scanner.nextLong();
        long x = scanner.nextLong();
        long y = scanner.nextLong();
        if (y%x!=0) {
            System.out.println("0");
            return;
        }
        long lim = y/x;
        long answer =0;
        for (long i=l; (i*i<=lim) && (i <=r);++i) {
            if (lim%i==0) {
                long b = lim/i;
                long gcd = gcd(i,b);
                if ((b>=l) && (b <=r) && ((gcd==x) && (lcm(i,b,gcd)==y))) {
                    if (i!=b) {
                       answer+=2;
                    } else {
                        answer++;
                    }
                }
            }
        }
        System.out.println(answer);
    }

    public static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static long lcm(long a, long b, long gcd) {
        return a * (b / gcd);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import javax.xml.crypto.dsig.keyinfo.KeyName;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class Main {
    public static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public static int read() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }

    public static int gcd(int a, int b){
        while (a>0 && b>0){
            if (a>b) a%=b; else b%=a;
        }
        return a+b;
    }

    public static void main(String[] args) throws IOException {
        int x=read();
        int y=read();
        int l=read();
        int r=read();
        if (y%x!=0){
            System.out.println(0);
            System.exit(0);
        }
        y/=x;
        int cnt=0;
        for (int i=1; i<100000; i++){
            if (y%i==0){
                int j=y/(i*x);
                if (i*x>=l && i*x<=r && j*x>=l && j*x<=r && gcd(i,j)==1){
                    if (i==j) cnt++;
                    if (i<j) cnt+=2;
                }
            }
        }
        System.out.println(cnt);
    }
}

import java.io.*;
import java.util.*;

public class C {

	static long x, y,mod = 1000*1000*1000+7;;
    static long gcd(long a ,long b)
    {
        if(b==0)
            return a;
        return gcd(b ,a%b);
    }
    public static int gcd(int a, int b) {
        while (b > 0) {
            int c = a;
            a = b;
            b = c % b;
        }
        return a;
    }
    static long expo(long x ,long n ,long mod)
    {
        long res=1;
        while(n>0)
        {
            if(n%2==1)
                res=(res*x)%mod;
            x=(x*x)%mod;
            n=n/2;
        }
        return res%mod;
    }

    static long fermat(long a ,long m)
    {
        return expo(a,m-2,m)%m;
    }

    static void extendedEuclidean(long a ,long m)
    {
        if(m==0)
        {
            x=1;
            y=0;
        }
        else
        {
            extendedEuclidean(m,a%m);
            long temp=x;
            x=y;
            y=temp-(a/m)*y;
        }

    }

    static long EuclidInverse(long a ,long m)
    {
        extendedEuclidean(a ,m);
        return (x%m+m)%m;
    }

	public static void main(String[] args) {

		FastScanner s = new FastScanner();
		long x = s.nextLong();
		long k = s.nextLong();

		if(k==0)
		{
			long ans = (2*x)%mod;
			System.out.println(ans);
			return;
		}
		if(x==0)
		{
			System.out.println(0);
			return;
		}

		long exp  =(k+1+mod)%mod;

		long a = (expo(2,exp,mod)*x)%mod;
		a = (a-(expo(2,k,mod)-1+mod)+mod  )%mod;
		a =a%mod;

		System.out.println(a%mod);
	}
static class FastScanner {

	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;

		}

	}

}

import java.util.Scanner;

public class NastyaStudiesInformatics {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int l=scanner.nextInt();
        int r=scanner.nextInt();
        int x=scanner.nextInt();
        int y=scanner.nextInt();

        System.out.println(solution_cf(l,r,x,y));

   /*     int count=0;
        for(int a=l;a<=r;a++){
            for (int b=a;b<=r;b++){
                *//*int gcd=gcd(a,b);
                int lcm=a*b/gcd;*//*
                if(x*y==a*b && x*x<=a*b && y*y>=a*b ){
                    if(a==b){
                        count++;
                    }
                    else {
                        count=count+2;
                    }
                    System.out.println(a+":"+b+":"+x+":"+y);

                }

            }
        }
        System.out.println(count);*/
    }
    static int gcd(int a, int b){
        if(b == 0) return a;
        return gcd(b, a% b);

    }

    static long solution_cf(int l,int r,int x,int y){

        int ans = 0;
        int n = y / x;
        for (int d = 1; d * d <= n; ++d) {
            if (n % d == 0) {
                int c = n / d;
                if (l <= c*d*x&&c*d*x<= r && gcd(c, d) == 1) {
                    if (d * d == n) ++ans;
                    else ans += 2;
                }
            }
            }

        return ans;
    }

}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int l=sc.nextInt();
		int r=sc.nextInt();
		int g=sc.nextInt();
		int lc=sc.nextInt();
		//System.out.println(lc);
		ArrayList<Integer> a=new ArrayList<Integer> ();
		for (int i=1; i<=Math.sqrt(lc); i++)
        {
            if (lc%i==0)
            {
                if (lc/i == i&&i%g==0&&i>=l&&i<=r)
                    a.add(i);

                else if(lc/i != i)
                {
                		if(i%g==0&&i>=l&&i<=r)
                		a.add(i);
                		if((lc/i)%g==0&&(lc/i)>=l&&(lc/i)<=r)
                		a.add(lc/i);

                }
            }
        }
        //System.out.println(a);
        int c=0;
        for(int i=0;i<a.size();i++)
        {
        	for(int j=i+1;j<a.size();j++)
        	{
        		long gc=(long)gcd(a.get(i),a.get(j));
        		long lcm=(long)((a.get(i)/g)*a.get(j));
                	if(gc==(long)(g)&&lcm==(long)(lc))
                	{
                		++c;
                	}
        }
        }
        if(lc%g != 0)
		{
		System.out.println("0");
		}

        else
        System.out.println(c*2);
	}
	public static int gcd(int a,int b)
	{
		if (b == 0)
    		return a;
    	return gcd(b, a % b);
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextInt();
            long r = in.nextInt();
            long x = in.nextInt();
            long y = in.nextInt();
            long xy = x * y;
            long ans = 0;
            for (long a = l; a * a <= r; a++) {
                if (xy % a == 0) {
                    long b = xy / a;
                    if (gcd(a, b) == x && lcm(a, b) == y) {
                        if (a == b) ans++;
                        else ans += 2;
                    }
                }
            }
            if (x == y && x * x >= r) ans++;
            out.println(ans);
        }

        long gcd(long a, long b) {
            if (b == 0) return a;
            return gcd(b, a % b);
        }

        long lcm(long a, long b) {
            return (a * b) / gcd(a, b);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long d = y / x;
            long count = 0;
            for (int i = 1; i <= (int) Math.sqrt(d); i++) {
                if (d % i == 0) {
                    long b = d / i;
                    if (gcd((long) i, b) == 1L) {
                        if ((long) i * x >= l && (long) i * x <= r && b * x >= l && b * x <= r) {
                            if ((long) i != b) count += 2;
                            else count += 1;
                        }
                    }
                }
            }
            out.print(count);
        }

        private long gcd(long a, long b) {
            long c;
            while (a != 0) {
                c = a;
                a = b % a;
                b = c;
            }
            return b;
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	static boolean visited[] ;
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ;
	static int seeds[] ;
	static int a[] ;
	static double total ;
	public static ArrayList adj[] ;
	public static long x,y ;
	public static ArrayList<Long> xx ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;

		long l = sc.nextLong() ;
		long r = sc.nextLong() ;
		long x = sc.nextLong() ;
		long y =sc.nextLong() ;

		if(x==y)
			if(x<=r && x>=l)
			{System.out.println(1);return ; }
			else
			{System.out.println(0);return ; }

		//// 10000000000000000l
		if(1l*x*y >= 1000000000000000l)
		{
			long c= 0 ;
			int limit = (int) Math.ceil(Math.min(r,y)/Math.max(x, l));
			for (int i = 1; i <= limit; i++)
				for (int j = 1; j <=limit; j++)
				{
					long a = 1l*i*x ;
					long b = 1l*j*x ;

					if(a>=Math.max(l, x) && a<=Math.min(r,y) && b>=Math.max(l, x) && b<=Math.min(r,y))
					{
						if((gcdThing(a, b)==x && (1l*a*b==1l*x*y)))c++;
					}

				}
			System.out.println(c); return ;
		}
		ArrayList<Long> arr = new ArrayList<Long>() ;
		arr = divisors(1l*x*y) ;
		Collections.sort(arr);

		long n = arr.size() ;
		long c=0 ;
		for (int i =(int) n/2; i <n; i++)
		{
			long a = arr.get(i);
			long b = arr.get((int)n-1-i);

			if(a>=Math.max(l, x) && a<=Math.min(r,y) && b>=Math.max(l, x) && b<=Math.min(r,y))
			{
				if(gcdThing(a, b)==x)if(a==b)c++; else c+=2;
				//if(gcdThing(a,b)==x)System.err.println(a+" "+b);
			}
			else
				break ;

		}
		System.out.println(c);
		//    2672374
		///2672374 422235092 1336187 844470184
		///                   105558773
		///                   10689496

	}

	// method to print the divisors
	static ArrayList<Long> divisors(long n)
	{
		ArrayList<Long> arr =  new ArrayList<Long>() ;
		// Note that this loop runs till square root
		for (int i=1; i<=Math.sqrt(n); i++)
		{
			if (n%i==0)

				// If divisors are equal, print only one
				if (n/i == i)
				{arr.add(1l*i);arr.add(1l*i);}

				else // Otherwise print both
				{arr.add(1l*i); arr.add(1l*n/i);}

		}

		return arr ;

	}

	public static void generate(long current)
	{
		if(current>10000000000l)
			return ;

		xx.add(current) ;
		generate((10*current) +4);
		generate((10*current) +7);

	}

	public static int neededFromLeft(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				c ++;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return c;
	}

	public static int neededFromRight(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		int c=0;
		boolean f=true;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f=false;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		return st.size();
	}

	public static boolean fromBoth(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		boolean f1=true ,f2=true ;

		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				f1 =false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)f2 = false ;

		if(f1==false && f2==false)
			return true ;
		else
			return false;
	}

	public static boolean isRegular(String x)
	{
		Stack<Character> st = new Stack<Character>() ;
		for (int i = 0; i < x.length(); i++)
		{
			char cur = x.charAt(i);
			if(cur==')' && st.isEmpty())
				return false ;
			else if(cur==')' && !st.isEmpty())
				st.pop();
			else if(cur=='(')
				st.push(cur);
		}
		if(st.size()>0)return false ; else return true ;
	}

	public static int gcdExtended(int a, int b)
	{
		// Base Case
		if (a == 0)
		{
			x = 0;
			y = 1;
			return b;
		}

		//int x1=1, y1=1; // To store results of recursive call
		int gcd = gcdExtended(b%a, a);

		// Update x and y using results of recursive
		// call
		long x1 = y - (b/a) * x;
		long y1 = x;
		x = x1 ;
		y = y1 ;

		return gcd;
	}

	static int even(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2==0)
				return current ;
		}
		return -1;
	}
	static int odd(String x , int b )
	{
		for (int j = b; j>=0; j--)
		{
			int current = x.charAt(j)-48 ;
			if(current%2!=0)
				return current ;
		}
		return -1;
	}
	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
	public static long solve(int k1, long k2)
	{
		long x   = 1l*k2*(pow(2, k1)-1) ;
		return x%(1000000007) ;
	}

	public static long getN(long x)
	{
		long n = (long) Math.sqrt(x*2) ;
		long y = n*(n+1)/2;
		if(y==x)
			return n ;
		else if(y>x)
			return n ;
		else
			for (long i = n; ; i++)
			{
				y = i*(i+1)/2 ;
				if(y>=x)
					return i ;

			}	}

	public static void dfss(int root , int len)
	{
		visited[root]=true ;
		if(ends[root] && root!=0) lens[root] = len ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ;
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ;
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ;
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ;
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}

	public static String concatinate(String s ,int n)
	{
		if(s.length()==n)
			return s ;
		else return concatinate("0"+s, n) ;
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}

	public static int cnt1(int mat[][])  //how many swaps to be a 1 matrix
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2==0 && mat[i][j]==0)
					c++;
				if(x%2!=0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}
	public static int cnt0(int mat[][])
	{
		int m = mat.length ;
		int c=0 ;
		for (int i = 0; i < mat.length; i++)
		{
			for (int j = 0; j < mat.length; j++)
			{
				int x =  (i*m) +j ;
				if(x%2!=0 && mat[i][j]==0)
					c++;
				if(x%2==0 && mat[i][j]==1)
					c++;

			}
		}
		return c;
	}

	public static boolean canFit2(int x1, int y1 , int x2 , int y2 , int x3 , int y3){
		if(x1==x2)
			if(x1==x3)
				return true ;
			else
				return false ;
		else
			if(x1==x3)
				return false ;
			else
			{
				long a = 1l*(y2-y1)*(x3-x2) ;
				long b = 1l*(y3-y2)*(x2-x1) ;

				if(a==b)
					return true;
				else
					return false ;

			}

	}
	public static void shuffle(pair[] ss){
		if(ss.length==1)
			return ;
		for (int i = 0; i < ss.length; i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.length-1) + 0;

			pair temp = ss[i] ;
			ss[i] = ss[n] ;
			ss[n] = temp ;
		}
	}
	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	{
		if (r>=l)
		{
			int mid = l + (r - l)/2;
			if (arr.get(mid).x== x)
				return mid;
			if (arr.get(mid).x> x)
				return binary(arr, l, mid-1, x);
			return binary(arr, mid+1, r, x);
		}
		return -1;
	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ;
	}

	////// searching for last element less than X
	public static int binary2(pair[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size()
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid].x >= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				high=mid;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				low = mid+1 ;
			}
		}
		return low ; // return high ;
	}

	private static boolean triangle(int a, int b , int c){
		if(a+b>c && a+c>b && b+c>a)
			return true ;
		else
			return false ;
	}
	private static boolean segment(int a, int b , int c){
		if(a+b==c || a+c==b && b+c==a)
			return true ;
		else
			return false ;
	}
	private static int gcdThing(long a, long b) {
		BigInteger b1 = BigInteger.valueOf(a);
		BigInteger b2 = BigInteger.valueOf(b);
		BigInteger gcd = b1.gcd(b2);
		return gcd.intValue();
	}

	public static boolean is(int i){
		if(Math.log(i)/ Math.log(2) ==(int) (Math.log(i)/ Math.log(2)))
			return true ;
		if(Math.log(i)/ Math.log(3) ==(int) (Math.log(i)/ Math.log(3)) )
			return true ;
		if(Math.log(i)/ Math.log(6) ==(int) (Math.log(i)/ Math.log(6)) )
			return true ;

		return false;

	}
	public static boolean contains(int b[] , int x)
	{
		for (int i = 0; i < b.length; i++)
		{
			if(b[i]==x)
				return true ;
		}
		return false ;
	}
	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length;
		while (low != high) {
			int mid = (low + high) / 2;
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ;
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ;
		else return false;
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}
	public static String solve11(String x){

		int n = x.length() ;
		String y = "" ;
		for (int i = 0; i < n-2; i+=2)
		{
			if(ifPalindrome(x.substring(i, i+2)))
				y+= x.substring(i, i+2) ;
			else
				break ;
		}
		return y+ solve11(x.substring(y.length(),x.length())) ;

	}
	public static String solve1(String x){
		String y = x.substring(0 , x.length()/2) ;
		return "" ;

	}
	public static String reverse(String x){
		String y ="" ;
		for (int i = 0; i < x.length(); i++)
		{
			y  = x.charAt(i) + y ;
		}
		return y ;
	}

	public static boolean ifPalindrome(String x){
		int numbers[] = new int[10] ;
		for (int i = 0; i < x.length(); i++)
		{
			int z = Integer.parseInt(x.charAt(i)+"") ;
			numbers[z] ++ ;
		}
		for (int i = 0; i < numbers.length; i++)
		{
			if(numbers[i]%2!=0)
				return false;
		}
		return true ;
	}

	public static int get(int n){
		return n*(n+1)/2 ;
	}
	//		public static long getSmallestDivisor( long y){
	//			if(isPrime(y))
	//				return -1;
	//
	//			for (long i = 2; i*i <= y; i++)
	//			{
	//				if(y%i ==0)
	//				{
	//					return i;
	//				}
	//			}
	//			return -1;
	//		}
	public static int lis( int[]a , int n){
		int lis[] = new int[n] ;
		Arrays.fill(lis,1) ;

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)
					lis[i] = lis[j] + 1;

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --;
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth;
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}

	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ;

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);

		return f ;

	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ;
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found;
	//		}

	public static class Vertix{
		long i ;
		int depth ;
		ArrayList<Vertix> neighbours ;
		Vertix parent ;
		Vertix child ;

		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		int x ;
		int y ;
		int i;

		public pair(int x, int y, int i ){

			this.x=x ;
			this.y =y ;
			this.i =i ;

		}

		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ;
			else if (this.x == p.x)
				return 0 ;
			else
				return -1 ;
		}

	}

	public static class pair2 implements Comparable<pair2>{
		int i ;
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ;
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ;
			else if (this.j == p.j) return 0 ;
			else
				return -1 ;
		}

	}
	public static class point implements  Comparable<point>
	{
		int x, y ;
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members
			point c = (point) o;

			// Compare the data members and return accordingly
			return Integer.compare(x, c.x) == 0
					&& Integer.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ;
			else
				return -1 ;
		}

		@Override
		public int hashCode()
		{
			return 15+x+(y%2) ;
		}

	}

}

import java.util.*;
import java.io.*;
import java.math.*;

public class MainClass
{
	public static long hits=0;

	public static void main(String[] args)  throws IOException
	{
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long l=in.nextLong();
		long r=in.nextLong();
		long x=in.nextLong();
		long y=in.nextLong();

		long ans=0;

		long n=x*y;
		long rt=(long) Math.sqrt(n);
		for(long i=Math.min(l, x);i<=Math.min(r, rt);i++)
		{
			if(n%i==0)
			{
				if(n/i==i && x==1L)
				{
					ans++;
				}
				else if(gcd(i,n/i)==x)
				{
					ans+=2;
				}
			}
		}
			out.println(ans);

			out.flush();
		out.close();
	}

	public static long gcd(long a, long b)
	{
		if(a==0)
			return b;
		if(a>b)return gcd(a%b,b);

		return gcd(b%a, a);
	}

}
class InputReader{
    private final InputStream stream;
    private final byte[] buf=new byte[1024];
    private int curChar;
    private int numChars;
    public InputReader(InputStream stream){this.stream=stream;}
    public int read()throws IOException{
        if(curChar>=numChars){
            curChar=0;
            numChars=stream.read(buf);
            if(numChars<=0)
                return -1;
        }
        return buf[curChar++];
    }
    public final int nextInt()throws IOException{return (int)nextLong();}
    public final long nextLong()throws IOException{
        int c=read();
        while(isSpaceChar(c)){
            c=read();
            if(c==-1) throw new IOException();
        }
        boolean negative=false;
        if(c=='-'){
            negative=true;
            c=read();
        }
        long res=0;
        do{
            if(c<'0'||c>'9')throw new InputMismatchException();
            res*=10;
            res+=(c-'0');
            c=read();
        }while(!isSpaceChar(c));
        return negative?(-res):(res);
    }
    public final int[] readIntBrray(int size)throws IOException{
        int[] arr=new int[size];
        for(int i=0;i<size;i++)arr[i]=nextInt();
        return arr;
    }
    public final String next()throws IOException{
        int c=read();
        while(isSpaceChar(c))c=read();
        StringBuilder res=new StringBuilder();
        do{
            res.append((char)c);
            c=read();
        }while(!isSpaceChar(c));
        return res.toString();
    }
    public final String nextLine()throws IOException{
        int c=read();
        while(isSpaceChar(c))c=read();
        StringBuilder res=new StringBuilder();
        do{
            res.append((char)c);
            c=read();
        }while(c!='\n'&&c!=-1);
        return res.toString();
    }
    private boolean isSpaceChar(int c){
        return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
    }

}

import java.util.*;
import java.io.*;
public class B {

	static int gcd(int a,int b) {return b==0?a:gcd(b,a%b);}
		public static void main(String[] args) throws IOException {
			Scanner sc=new Scanner(System.in);
			PrintWriter pw=new PrintWriter (System.out);
			int l=sc.nextInt(),r=sc.nextInt(),x=sc.nextInt(),y=sc.nextInt();
			int ans=0;
			if(y%x==0) {
				int target=y/x;
				for(int i=1;i*i<=target;i++)
				{
					int j=target/i;
					if(gcd(i, j)!=1)
						continue;
					if(i>=l && i<=r)
						ans++;
					if(i!=j && j>=l && j<=r)
						ans++;

				}

			}
			pw.println(ans);

			pw.close();
		}

	static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader s) {
            br = new BufferedReader(s);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException { return br.readLine();}
        public boolean ready() throws IOException {return br.ready();}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}

    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rishabhdeep Singh
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        List<Integer> divisors(int n) {
            List<Integer> set = new ArrayList<>();
            for (int i = 1; i <= Math.sqrt(n); i++) {
                if (n % i == 0) {
                    if ((n / i) == i)
                        set.add(i);
                    else
                        set.add(n / i);
                }
            }
            return set;
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int l = in.nextInt(), r = in.nextInt(), gcd = in.nextInt(), lcm = in.nextInt();
            List<Integer> list = divisors(lcm);
            Set<TaskB.Pair<Integer, Integer>> set = new HashSet<>();
            for (int i = 0; i < list.size(); i++) {
                int a = lcm / list.get(i);
                int b = gcd * list.get(i);
                long GCD = Utilities.gcd(a, b);
                if (GCD == (long) gcd && ((long) a * (long) b) == ((long) lcm * GCD))
                    if (l <= a && a <= r && l <= b && b <= r) {
                        TaskB.Pair<Integer, Integer> p = new TaskB.Pair<>(a, b);
                        TaskB.Pair<Integer, Integer> q = new TaskB.Pair<>(b, a);
                        set.add(p);
                        if (a != b)
                            set.add(q);
                    }
            }
            out.println(set.size());
        }

        public static class Pair<first, second> {
            public first First;
            public second Second;

            public Pair(first First, second Second) {
                this.First = First;
                this.Second = Second;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class Utilities {
        public static long gcd(long a, long b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }

    }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code2
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		long l = in.nextLong();
		long r = in.nextLong();
		long x = in.nextLong();
		long y = in.nextLong();

		if(x==y)
		{
			if(x>=l && x<=r)
				pw.println(1);
			else
				pw.println(0);
		}
		else
		{
		y/=x;
		HashSet<Long> set = new HashSet<>();
		long ans = 1;
		while(x!=1 && y%x==0)
		{
			y/=x;
			ans*=x;
		}
		if(ans!=1L)
			set.add(ans);

		for(int i=2;(long)i*(long)i<=y;i++)
		{
			ans = 1;
			while(y%i==0)
			{
				y/=i;
				ans*=i;
			}
			if(ans!=1L)
				set.add(ans);
		}
		if(y!=1)
		set.add(y);
		long mul = 1;
		for(long p : set)
			mul*=p;

		HashSet<pair> answer = new HashSet<>();
		ans = 1;
		for(long p : set)
		{
			ans*=p;
			long one = x*ans;
			long two = (mul*x)/ans;
			if(one>=l && one<=r && two>=l && two<=r)
				answer.add(new pair(one,two));
		}
		//System.out.println(answer.toString());
		int count = 0;
		for(pair p : answer)
		{
			if(p.x!=p.y)
				count++;
			count++;
		}
		pw.println(count);
		}
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int 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;
	}

	static class pair implements Comparable<pair>
	{
		Long x, y;
		pair(long x,long y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.*;

public class firstone {

    public static void main(String[] args) {

        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        NumberFormat formatter = new DecimalFormat("#0.000000000000");

        long l = in.nextLong();
        long r = in.nextLong();
        long G = in.nextLong();
        long L = in.nextLong();
        if(L%G!=0)
        {
            out.print("0");
            out.close();
            return;
        }
        long mul = L*G;
        long sqrt = (long) (Math.sqrt(mul) + 1);
        long ans = 0;
        for (long i = G;i<sqrt ; i++)
        {
            if(mul % i == 0)
            {
                L = mul / i;
                if(i>=l && i<=r && L>=l & L<=r && gcd(i,L) == G)
                {
                    ans++;
                }
            }
        }
        out.println(ans*2);

        out.close();

    }
    public static long gcd(long a, long b) {
        while (b > 0) {
            long c = a;
            a = b;
            b = c % b;
        }
        return a;
    }

    static public final class Pair<A, B> {
        private final A a;
        private final B b;

        private Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        /**
         * Returns a pair whose elements are the first and second
         * arguments, respectively.
         * @return a pair constructed from the arguments
         */
        public static <C, D> Pair<C, D> valueOf(C c, D d) {
            // Don't mandate new values.
            return new Pair<C, D>(c, d);
        }

        /**
         * Returns the value of the first element of the pair.
         * @return the value of the first element of the pair
         */
        public A getA() {
            return a;
        }

        /**
         * Returns the value of the second element of the pair.
         * @return the value of the second element of the pair
         */
        public B getB() {
            return b;
        }

        /**
         * TBD
         */
        @Override
        public String toString() {
            return "[" + Objects.toString(a) + ", " + Objects.toString(b) + "]";
        }

        /**
         * TBD
         */
        @Override
        public boolean equals(Object x) {
            if (!(x instanceof Pair))
                return false;
            else {
                Pair<?,?> that = (Pair<?,?>) x;
                return
                        Objects.equals(this.a, that.a) &&
                                Objects.equals(this.b, that.b);
            }
        }

        /**
         * TBD
         */
        @Override
        public int hashCode() {
            return Objects.hash(a, b);
        }
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyBufferedReader in = new MyBufferedReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, MyBufferedReader in, PrintWriter out) {
            long[] d = in.getALineOfLong(4);
            long l = d[0];
            long r = d[1];
            long x = d[2];
            long y = d[3];

            if (y % x != 0) {
                out.println(0);
                return;
            }

            long res = 0;
            long withoutGCD = y / x;
            for (long i = l; i <= r && i * i < withoutGCD; i++) {
                if (withoutGCD % i == 0 && withoutGCD / i <= r && gcd(withoutGCD / i, i) == 1) {
                    res += withoutGCD == 1 ? 1 : 2;
                }
            }

            out.println(res);
        }

        private long gcd(long a, long b) {
            if (b == 0)
                return a;

            return gcd(b, a % b);
        }

    }

    static class MyBufferedReader {
        BufferedReader in;

        public MyBufferedReader(InputStream s) {
            this.in = new BufferedReader(new InputStreamReader(s));
        }

        public MyBufferedReader(BufferedReader in) {
            this.in = in;
        }

        public long[] getALineOfLong(int numExpected) {
            if (numExpected == 0) {
                return new long[0];
            }

            long[] res = new long[numExpected];
            StringTokenizer st = null;
            try {
                st = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
            for (int i = 0; i < numExpected; i++)
                res[i] = Long.parseLong(st.nextToken());
            return res;
        }

    }
}

import java.util.Scanner;

public class A489 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		long x = sc.nextLong();
		long y = sc.nextLong();
		long mul = Math.max(x, y);
		long min = x * y / mul;
		long count = 0;
		for (int i = l; i <= Math.sqrt(mul); i++) {
			if (mul % i == 0 && min * i <= r && mul / i <= r && gcd(min * i, mul / i) == x && mul / i != x
					&& mul / i != y) {
				if (min * i != mul / i)
					count += 2;
				else
					count++;
				// System.out.println(min * i + " " + mul / i);
			}
		}
		if (x >= l && x <= r && y >= l && r >= y) {
			// System.out.println("hello");
			if (x != y)
				count += 2;
			else
				count++;
		}
		System.out.println(count);
	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}
}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        long l = in.nextInt();
        long r = in.nextInt();
        long x = in.nextInt();
        long y = in.nextInt();

        if (y%x != 0){
            out.println(0);
            return;
        }

        if (x >= r || y <= l){
            out.println(0);
            return;
        }

        if (x == y){
            out.println(1);
            return;
        }

        long ans = 0;
        for (long a = x; a <= Math.sqrt(x*y); a+=x) {
            long b = x*y/a;
            debug.print(a + " " + b);

            if (a >= l && a <= r && b >= l && b <= r){
                debug.print(" +");

                    if (gcd(a,b)==x && lcm(a,b)==y){
                        debug.print(" +");
                        ans++;
                    }
            }

            debug.println("");
        }

        out.println(ans*2);
    }

    static long gcd (long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }

    static long lcm (long a, long b) {
        return a / gcd (a, b) * b;
    }

    public static final String NAME = "";

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            if (NAME.length() > 0) {
                in = new InputReader(new BufferedReader(new FileReader(NAME + ".in")));
                out = new PrintWriter(new FileWriter(NAME + ".out"));
            } else {
                in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
                out = new PrintWriter(new OutputStreamWriter(System.out));
            }

            debug = new DebugWriter(false);
            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException{
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}

import java.awt.color.*;
import java.util.*;

import java.awt.Point;
import java.math.*;
import java.io.*;
@SuppressWarnings("unused")
public class gcd {int[] b;	int n;String g="";int c=0;int M=1000000000+7;ArrayList<Integer> list=new ArrayList<Integer>();String s;int[] size;int[] id;
int[]ab;int[] data;int mod=100000;LinkedList<Integer> queue=new LinkedList<Integer>();int dis=0;int max=0;ArrayList<Integer>[] arr;
	public static void main(String[] args) {
              new  gcd().solve();
                                  }

            public void solve() {
           int l=sc.nextInt();int r=sc.nextInt();int x=sc.nextInt();int y=sc.nextInt();

           for(int i=l;i<=(l+r)/2+1;i++) {
        	   int p=(x*y)%i;
        	   int u=(x*y)/i;
        	   if(p==0&&u>=l&&u<=r) {
        		   int g=gcd(i,u);
        		   int lc=(x*y)/g;
        		   if(g==x&&lc==y)
        			   c++;
        	   }
           }

                }

            static int lcm(int a, int b)
            {
                return (a*b)/gcd(a, b);
            }
            public static int gcd(int a, int b)
            {
                if (a == 0)
                    return b;

                return gcd(b%a, a);
            }
            public static int gcdExtended(int a, int b, int x, int y)
            {
                // Base Case
                if (a == 0)
                {
                    x = 0;
                    y = 1;
                    return b;
                }

                int x1=1, y1=1; // To store results of recursive call
                int gcd = gcdExtended(b%a, a, x1, y1);

                // Update x and y using results of recursive
                // call
                x = y1 - (b/a) * x1;
                y = x1;

                return gcd;
            }
      public class Node{
	     long x;long color;long y;
	       Node par;ArrayList<Point> pp=new ArrayList<Point>();
	        public Node(long a) {
	          	x=a;

	             }
                  }
              class sortbyweight implements Comparator<Point>{

				@Override
				public int compare(Point arg0, Point arg1) {
					// TODO Auto-generated method stub

					return (int)(arg0.y-arg1.y);
				}}

				 FastReader sc=new FastReader();
				 static class FastReader
				     {
				         BufferedReader br;
				         StringTokenizer st;

				         public FastReader()
				         {
				             br = new BufferedReader(new
				                      InputStreamReader(System.in));
				         }

				         String next()
				         {
				             while (st == null || !st.hasMoreElements())
				             {
				                 try
				                 {
				                     st = new StringTokenizer(br.readLine());
				                 }
				                 catch (IOException  e)
				                 {
				                     e.printStackTrace();
				                 }
				             }
				             return st.nextToken();
				         }

				         int nextInt()
				         {
				             return Integer.parseInt(next());
				         }

				         long nextLong()
				         {
				             return Long.parseLong(next());
				         }

				         double nextDouble()
				         {
				             return Double.parseDouble(next());
				         }

				         String nextLine()
				         {
				             String str = "";
				             try
				             {
				                 str = br.readLine();
				             }
				             catch (IOException e)
				             {
				                 e.printStackTrace();
				             }
				             return str;
				         }
				     }}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class codeforces
{
   static class Student{
       int x,y;
        Student(int x,int y){
            this.x=x;
            this.y=y;
            //this.z=z;
        }
    }
    static int prime[];
    static void sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        int pos=0;
        prime= new int[n+1];
        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == 0)
            {
                // Update all multiples of p
                prime[p]=p;
                for(int i = p*p; i <= n; i += p)
                    prime[i] = p;
            }
        }
    }
static    class Sortbyroll implements Comparator<Student>
{
    // Used for sorting in ascending order of
    // roll number
    public int compare(Student c, Student b)
    {
        return c.x-b.x;
    }
}
static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static class Edge{
        int a,b;
        Edge(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
    static class Trie{
        HashMap<Character,Trie>map;
         int c;
        Trie(){
            map=new HashMap<>();
            //z=null;
            //o=null;
            c=0;
        }
    }
    //static long ans;
    static int parent[];
    static int rank[];
    static int b[][];
    static int bo[];
    static int ho[];
    static int seg[];
    //static int pos;
   // static long mod=1000000007;
    //static int dp[][];
    static HashMap<Integer,Integer>map;
    static PriorityQueue<Student>q=new PriorityQueue<>();
    //static Stack<Integer>st;
   // static ArrayList<Character>ans;
    static ArrayList<ArrayList<Integer>>adj;
    static long ans;
    static Trie root;
    static long fac[];
    static int gw,gb;
    static long mod=(long)(1000000007);
    //static int ans;
    static void solve()throws IOException{
        FastReader sc=new FastReader();
        int l,r,x,y,i;
        long ans=0;
        l=sc.nextInt();
        r=sc.nextInt();
        x=sc.nextInt();
        y=sc.nextInt();
        if(y%x!=0)
            System.out.println(0);
        else{
            y=y/x;
            for(i=1;i<=Math.sqrt(y);i++){
                if(y%i==0){
                    if((long)i*(long)x>=(long)l&&(long)i*(long)x<=r&&(long)(y/i)*(long)(x)>=(long)l&&(long)(y/i)*(long)x<=r&&gcd((long)x*(long)i,(long)x*(long)(y/i))==(long)x)
                        ans+=(long)2;
                }
            }
            System.out.println(ans);
        }
    }
    static void dfs(ArrayList<ArrayList<Student>>sum,int i,int c[],int a[],int b[]){
        for(int x=0;x<adj.get(i).size();x++){
            if(c[adj.get(i).get(x)]==1)
                continue;
            gw+=a[adj.get(i).get(x)];
            gb+=b[adj.get(i).get(x)];
            sum.get(sum.size()-1).add(new Student(a[adj.get(i).get(x)],b[adj.get(i).get(x)]));
            c[adj.get(i).get(x)]=1;
            dfs(sum,adj.get(i).get(x),c,a,b);
        }
    }
    static long nCr(long n, long r,
                                    long p)
    {
        return (fac[(int)n]* modInverse(fac[(int)r], p)
                % p * modInverse(fac[(int)(n-r)], p)
                                    % p) % p;
    }
    //static int prime[];
    //static int dp[];
    public static void main(String[] args){
        //long sum=0;
        try {
                codeforces.solve();
                } catch (Exception e) {
                    e.printStackTrace();
                }
    }
       static long modInverse(long n, long p)
    {
        return power(n, p-(long)2,p);
    }
 static long power(long x, long y, long p)
{
    long res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y %(long)2!=0)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res%p;
 }
    /*public static long power(long x,long a) {
		if(a==0) return 1;
		if(a%2==1)return (x*1L*power(x,a-1))%mod;
		return (power((int)((x*1L*x)%mod),a/2))%mod;
	}*/
   static int find(int x)
    {
        // Finds the representative of the set
        // that x is an element of
        while(parent[x]!=x)
        {
            // if x is not the parent of itself
            // Then x is not the representative of
            // his set,
            x=parent[x];

            // so we recursively call Find on its parent
            // and move i's node directly under the
            // representative of this set
        }

        return x;
    }
    static void union(int x, int y)
    {
        // Find representatives of two sets
        int xRoot = find(x), yRoot = find(y);

        // Elements are in the same set, no need
        // to unite anything.
        if (xRoot == yRoot)
            return;

         // If x's rank is less than y's rank
        if (rank[xRoot] < rank[yRoot])

            // Then move x under y  so that depth
            // of tree remains less
            parent[xRoot] = yRoot;

        // Else if y's rank is less than x's rank
        else if (rank[yRoot] < rank[xRoot])

            // Then move y under x so that depth of
            // tree remains less
            parent[yRoot] = xRoot;

        else // if ranks are the same
        {
            // Then move y under x (doesn't matter
            // which one goes where)
            parent[yRoot] = xRoot;

            // And increment the the result tree's
            // rank by 1
            rank[xRoot] = rank[xRoot] + 1;
        }
    }
    static long gcd(long a, long b)
    {
        if (a == 0){
             //ans+=b;
            return b;
        }
        return gcd(b % a, a);
    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        InputReader input_reader = new InputReader(System.in);
        OutputWriter output_writer = new OutputWriter(System.out);
        ProblemSolver solver = new ProblemSolver();
        solver.solve(input_reader, output_writer);
        output_writer.flush();
        output_writer.close();
    }

    private static class ProblemSolver {

        long GCD(long a, long b) {
            long x = Math.max(a,b);
            long y = Math.min(a,b);
            if (x%y==0l) {
                return y;
            }
            return GCD(x%y, y);
        }

        public void solve(InputReader input, OutputWriter output)
                throws IOException {
            long L = input.nextLong(), R = input.nextLong(), X = input.nextLong(), Y = input.nextLong();
            long bound = (long)Math.floor(Math.sqrt(X*Y));
            long prod = X*Y;
            long result = 0l;
            for (long i=X;i<=bound && i>=L && i<=R;i+=X) {
                long see = prod/i;
                if ((X*Y)%i==0l && GCD(see, i)==X) {
                    if (see==i) {
                        result++;
                    } else {
                        result += 2l;
                    }
                }
            }
            output.printLine(result);
            output.flush();
        }
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

    private static class OutputWriter {

        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }
}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Solution
{
    static class InputReader
	{
	    private final InputStream stream;
	    private final byte[] buf = new byte[8192];
	    private int curChar, snumChars;

	    public InputReader(InputStream st) {
	      this.stream = st;
	    }

	    public int read() {
	      if (snumChars == -1)
	        throw new InputMismatchException();
	      if (curChar >= snumChars) {
	        curChar = 0;
	        try {
	          snumChars = stream.read(buf);
	        } catch (IOException e) {
	          throw new InputMismatchException();
	        }
	        if (snumChars <= 0)
	          return -1;
	      }
	      return buf[curChar++];
	    }

	    public int nextInt() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      int res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public long nextLong() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      int sgn = 1;
	      if (c == '-') {
	        sgn = -1;
	        c = read();
	      }
	      long res = 0;
	      do {
	        res *= 10;
	        res += c - '0';
	        c = read();
	      } while (!isSpaceChar(c));
	      return res * sgn;
	    }

	    public int[] nextIntArray(int n) {
	      int a[] = new int[n];
	      for (int i = 0; i < n; i++) {
	        a[i] = nextInt();
	      }
	      return a;
	    }

	    public String readString() {
	      int c = read();
	      while (isSpaceChar(c)) {
	        c = read();
	      }
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isSpaceChar(c));
	      return res.toString();
	    }

	    public String nextLine() {
	      int c = read();
	      while (isSpaceChar(c))
	        c = read();
	      StringBuilder res = new StringBuilder();
	      do {
	        res.appendCodePoint(c);
	        c = read();
	      } while (!isEndOfLine(c));
	      return res.toString();
	    }

	    public boolean isSpaceChar(int c) {
	      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	    }

	    private boolean isEndOfLine(int c) {
	      return c == '\n' || c == '\r' || c == -1;
	    }
	}
    public static int gcd(int a,int b)
    {
        if(a==0)
            return b;

        return gcd(b%a,a);
    }
    public static void main(String[] args) throws IOException
    {
        InputReader in=new InputReader(System.in);
        int l=in.nextInt();
        int r=in.nextInt();
        int x=in.nextInt();
        int y=in.nextInt();
        if(y%x!=0)
        {
            System.out.println("0");
            return;
        }
        int num=y/x;
        ArrayList<Integer> list=new ArrayList<Integer>();
        long count=0;
        for(int i=1;i<=(int)Math.sqrt(y/x);i++)
        {
            if(y%i==0)
            {
                if(i*x>=l && i*x<=r && (num/i)*x>=l && (num/i)*x<=r && gcd(num/i,i)==1)
                {
                    if(i!=num/i)
                    {
                        count+=2L;
                    }
                    else
                    {
                        count+=1L;
                    }
                }
            }
        }
        System.out.println(count);
    }
}

import java.util.*;
import java.lang.*;
import java.io.*;
public class B489{
	public static void main(String[] args) {
		InputReader fi=new InputReader(System.in);
		PrintWriter pr=new PrintWriter(System.out);
		long l=fi.nextLong();
		long r=fi.nextLong();
		long x=fi.nextLong();
		long y=fi.nextLong();
		long num=x*y;
		int cnt=0;
		for (long i=1; i<=Math.sqrt(num); i=i+x)
		{
			if (num%i==0)
			{
				if (num/i == i)
				{
					long m=i;
					if(l<=m&&m<=r&&m==x&&(m*m)==y){
						//pr.printf("%d  %d\n",m,m);
						cnt++;
					}
				}
				else
				{
					long m=i;
					long n=num/i;
					long gcdvalue=0;
					if(m<n)
						gcdvalue=gcd(n,m);
					else
						gcdvalue=gcd(m,n);

					long lcmvalue=n*m/gcdvalue;

					if(l<=m&&n<=r&&gcdvalue==x&&lcmvalue==y) {
						cnt++;
						//pr.printf("%d  %d\n",m,n);

					}
					if(l<=n&&m<=r&&gcdvalue==x&&lcmvalue==y) {
						cnt++;
						//pr.printf("%d  %d\n",n,m);
					}
				}

			}
		}

		pr.println(cnt);
		pr.close();
	}
	static long gcd(long a, long b) {
		while (b != 0) {
			long t = a;
			a = b;
			b = t % b;
		}
		return a;
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[8192];
	private int curChar, snumChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int snext() {
		if (snumChars == -1)
			throw new InputMismatchException();
		if (curChar >= snumChars) {
			curChar = 0;
			try {
				snumChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (snumChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int nextInt() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public long nextLong() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = snext();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = snext();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public int[] nextIntArray(int n) {
		int a[] = new int[n+1];
		for (int i = 1; i <= n; i++)
			a[i] = nextInt();
		return a;
	}

	public String readString() {
		int c = snext();
		while (isSpaceChar(c))
			c = snext();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = snext();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(in.readLine());
        long l = Integer.parseInt(st.nextToken());
        long r = Integer.parseInt(st.nextToken());
        long gcd = Integer.parseInt(st.nextToken());
        long lcm = Integer.parseInt(st.nextToken());
        long n = gcd*lcm;
        int sqrt = (int) Math.sqrt(lcm)+1;
        long res = 0;
        for (int i = 1; i <= sqrt; i++) {
            if (lcm % i == 0) {
                long x = lcm/i;
                if (i >= l && i <= r && x >= l && x <= r) {
                    if (lcm(i, x) == lcm && gcd(i, x) == gcd) {
                        if (i == x) {
                            res++;
                        } else {
                            res += 2;
                        }
                    }
                }
            }
        }
        System.out.println(res);
    }
    static long gcd(long p, long q) {
        if (q == 0) return p;
        else return gcd(q, p % q);
    }
    static long lcm(long a, long b) {
        return (a*b)/(gcd(a,b));
    }
}
/*

 */

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
   InputStream is;
	PrintWriter out;
	String INPUT = "";
 //class Declarations
void solve()
{
long l=nl(),r=nl(),x=nl(),y=nl();
long div=y/x;
boolean[] prime=new boolean[(int)(1e5)+10];
ArrayList<Integer> al=new ArrayList<>();
for(int i=2;i*i<prime.length;++i){
    if(!prime[i]){
        int j=i+i;
        while(j<prime.length) {
            prime[j]=true;
            j=j+i;
        }
    }
}
for(int i=2;i<prime.length;++i) if(!prime[i]) al.add(i);
//pn(al.size());
//pn("Div is "+div);
ArrayList<Integer> fact=new ArrayList<>();
// System.out.println("Reached");
     for(int z:al){
      if(div==1) break;
         int ans=1;
        // pn("div "+div);
        boolean f=false;
            while(div%z==0){
                f=true;
                ans*=z;
                div/=z;
            }
        if(f) fact.add(ans);

    }

//pn(fact);
int permut=1<<fact.size();
int cnt=0;
for(int i=0;i<permut;++i){
    long left=1,right=1;
    for(int j=0;j<fact.size();++j){
        int bit=(i>>j)&1;
        if(bit==1){
            left*=(long)fact.get(j);
        }
        else{
            right*=(long)fact.get(j);
        }
    }
    left=left*(long)x;right*=(long)x;
    long g=gcd(left,right);
    long lcm=(left*right)/g;

    if(left>=l&&left<=r&&right>=l&&right<=r&&g==x&&lcm==y)  {
        cnt++;
        //pn(left+" "+right);
    }
}
pn(cnt);

}
int min(int[] arr)
{
    int min=Integer.MAX_VALUE;
    for(int i=0;i<arr.length;++i)
    {
        if(min>arr[i]) min=arr[i];
    }
    return min;
}
int max(int[] arr)
{
    int max=Integer.MIN_VALUE;
    for(int i=0;i<arr.length;++i)
    {
        if(max<arr[i]) max=arr[i];
    }
    return max;
}
static long gcd(long x,long y)
{
  if(y==0) return x;
  return gcd(y,x%y);
}
static long nCr(long n,long rc)
{
 long r=Math.min(rc,n-rc);
 long ans=1;
 for(int i=1,j=(int)n;i<=r;++i,--j)
 {
   ans=(ans*(long)j)/((long)i);
 }
  return ans;

}

void run() throws Exception
{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
}

	public static void main(String[] args) throws Exception { new Main().run(); }

//output methods
private void pn(Object o)
{
	out.println(o);
}
private void p(Object o)
{
	out.print(o);
}

//input methods
		private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}
class pair implements Comparable<pair>{
    int x,y;
    pair (int i,int j)
    {
        x=i;
        y=j;

    }

    public int compareTo(pair p)
    {
        if(this.x!=p.x)
        {
            return this.x-p.x;
        }
        else
        {
            return this.y-p.y;
        }
    }
    public boolean equals(pair x)
    {
        return (x.x==this.x&&x.y==this.y);
    }
}

//package codeforces.Round489;

import java.util.Scanner;

public class NastyaStudiesInformatics {

    private static long x;
    private static long y;

    private static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    private static long lcm(long a, long b) {
        return (a*b) / gcd(a, b);
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        long l = s.nextLong();
        long r = s.nextLong();
        x = s.nextLong();
        y = s.nextLong();

        long res = 0;
        long c = y / x;
        if (y % x == 0) {
            for (int i = 1; i <= Math.sqrt(y / x); i++) {
                long z = c / i;
                if (i >= l && z <= r && c % i == 0 && gcd(i, z) == 1) {
                    if (z == i) res++;
                    else res += 2;
                }
            }
        }

        System.out.println(res);

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            long l = in.nextLong();
            long r = in.nextLong();
            long x = in.nextLong();
            long y = in.nextLong();

            long d = y / x;
            long count = 0;
            for (int i = 1; i <= (int) Math.sqrt(d); i++) {
                if (d % i == 0) {
                    long b = d / i;
                    if (gcd((long) i, b) == 1) {
                        if ((long) i >= l && (long) i <= r && b >= l && b <= r) {
                            if ((long) i != b) count += 2;
                            else count += 1;
                        }
                    }
                }
            }
            out.print(count);
        }

        private long gcd(long a, long b) {
            long c;
            while (a != 0) {
                c = a;
                a = b % a;
                b = c;
            }
            return b;
        }

    }

    static class FastScanner {
        private BufferedReader bufferedReader;
        private StringTokenizer stringTokenizer;

        public FastScanner(InputStream inputStream) {
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

import java.io.*;
import java.util.*;

public class cf489B{
	static long gcd(long x, long y){
       if(x%y==0){
         return y;
       }

       return gcd(y,x%y);
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		long x = sc.nextLong();
		long y = sc.nextLong();
        long ans = 0;
        //HashSet<ArrayList<Integer>>
		if(y%x!=0){
          System.out.println("0");
		}
		else{
			long d = x*y;
			for(long i=x;i<(long)(Math.sqrt(d)+1);i+=x){
               if(d%i==0){
                 long dd = d/i;
                 if(dd>=l && dd<=r && i>=l && i<=r && gcd(dd,i)==x){
                    ans+=2;
                 }
               }
			}
			System.out.println(ans);
		}

	}
}

import java.util.*;
import java.io.*;

   public class x992B
   {
      public static void main(String args[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int L = Integer.parseInt(st.nextToken());
         int R = Integer.parseInt(st.nextToken());
         int X = Integer.parseInt(st.nextToken());
         int Y = Integer.parseInt(st.nextToken());
         //
         if(Y%X != 0)
         {
            System.out.println(0);
            return;
         }
         int res = 0;
         int boof = Y/X;
         for(int i=1; i < Math.sqrt(boof); i++)
         {
            if(boof%i == 0)
               res++;
         }
         res *= 2;
         System.out.println(res);
      }
   }

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class prog_A {
	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int l = in.nextInt();
		int r = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int ans = 0;
		if (y % x == 0) {
			y /= x;
			for (int i = 1; i * i <= y; i++) {
				if (y % i == 0) {
					int a = i;
					int b = y / i;
					if (gcd(a, b) == 1) {
						if (l <= Math.min(a, b) * x && Math.max(a, b) * x <= r)
							ans += 2;
					}
				}
			}
		}
		out.println(ans);
		in.close();
		out.close();
	}
}

//package main;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	static List<Integer> primeGenerator(int max) {
		boolean[] isNotPrime = new boolean[max];

		for(int i = 2; i < max; i++) {
			if(isNotPrime[i]) continue;

			isNotPrime[i] = false;
			for(int j = i + i; j < max; j += i) {
				isNotPrime[j] = true;
			}
		}

		List<Integer> list = new ArrayList<Integer>();

		for(int i = 2; i < max; i++) {
			if(!isNotPrime[i]) list.add(i);
		}

		return list;
	}

	static List<Long> getPrimeFactors(long n) {
		List<Integer> primes = primeGenerator((int)Math.sqrt(n));

		List<Long> primeFactors = new ArrayList<>();

		int index = 0;
		while(n > 1 && index < primes.size()) {
			int prime = primes.get(index);
			int pow = 0;
			while(n % prime == 0) {
				n /= prime;
				pow++;
			}
			index++;
			if(pow > 0) primeFactors.add((long)Math.pow(prime, pow));
		}
		if(n > 1) primeFactors.add(n);

		return primeFactors;

	}

	static int lookAnswer(List<Long> primeFactors, long part, long val, int index) {
		int ans = 0;
		for(int i = index; i < primeFactors.size(); i++) {
			long newVal = primeFactors.get(index);
			long f1 = x * (val);
			long f2 = x * (part / val);

			if(Math.min(f1, f2) >= l && Math.max(f1, f2) <= r) ans++;

			ans += lookAnswer(primeFactors, part, newVal, i + 1);
		}
		return ans;
	}

	static long l,r,x,y;

	public static void main(String[] args) throws Exception {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] data = reader.readLine().split("\\s+");
		reader.close();

		l = Integer.parseInt(data[0]);
		r = Integer.parseInt(data[1]);
		x = Integer.parseInt(data[2]);
		y = Integer.parseInt(data[3]);

		if((y % x) != 0) {
			System.out.println(0);
			return;
		}

		if(x == y) {
			if(x < l || y > r) System.out.println(0);
			else System.out.println(1);
			return;
		}

		long part = y / x;

		List<Long> primeFactors = getPrimeFactors(part);

		int ans = 0;
		for(int i = 0; i < primeFactors.size(); i++) ans += lookAnswer(primeFactors, part, 1, i);

		if(x >= l && y <= r) ans++;

		System.out.println(ans);
	}
}