Yet another XOR problem - MarisaOJ: Marisa Online Judge

Yet another XOR problem

Time limit: 1000 ms
Memory limit: 256 MB
Given an integer $x$. Count the number of values $y$ that $L \le y \le R$ and $ x \oplus y \le S$. ### Input - A single line contains 4 integers $x, L, R, S$. ### Output - Print the number of satisfied numbers. ### Constraints - $1 \le x, L, R, S \le 10^{18}$. ### Example Input: ``` 3 2 7 5 ``` Output: ``` 4 ```