Problem:
Score : 900 points

Problem Statement

Nukes has an integer that can be represented as the bitwise OR of one or more integers between A and B (inclusive).
How many possible candidates of the value of Nukes's integer there are?

Constraints

1 ≤ A ≤ B < 2^{60}

A and B are integers.

Input

The input is given from Standard Input in the following format:

A
B

Output

Print the number of possible candidates of the value of Nukes's integer.

Sample Input 1

7
9

Sample Output 1

4

In this case, A=7 and B=9. There are four integers that can be represented as the bitwise OR of a non-empty subset of {7, 8, 9}: 7, 8, 9 and 15.

Sample Input 2

65
98

Sample Output 2

63

Sample Input 3

271828182845904523
314159265358979323

Sample Output 3

68833183630578410

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

/********************************************************************************
	
	Code by a weak man who named CYJian, and he hopes the code can get more scores.

	Algorithm: 

 ********************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

//{{{ FAST IO
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

inline int clz(ll x) {
	int t = 0;
	if(x >> 32) t |= 32, x >>= 32;
	if(x >> 16) t |= 16, x >>= 16;
	if(x >> 8) t |= 8, x >>= 8;
	if(x >> 4) t |= 4, x >>= 4;
	if(x >> 2) t |= 2, x >>= 2;
	if(x >> 1) t |= 1, x >>= 1;
	return t;
}

inline ull calc(ull l, ull r) {
	if(l == r) return 1;
	int lg = clz(l ^ r);
	ll v1 = 1llu << (lg + 1);
	l &= v1 - 1, r &= v1 - 1;
	int Lg = clz(r ^ (v1 >> 1)) + 1;
	ll v2 = 1llu << Lg;
	if(v2 > l) return v1 - l;
	return v1 + v2 - (l << 1);
}

int main() {

		ll l = rl, r = rl;
		printf("%lld\n", calc(l, r));
	return 0;
}