The year 2015 is almost over.

Limak is a little polar bear. He has recently learnt about the binary system. He noticed that the passing year has exactly one zero in its representation in the binary system — 2015_10 = 11111011111_2. Note that he doesn't care about the number of zeros in the decimal representation.

Limak chose some interval of years. He is going to count all years from this interval that have exactly one zero in the binary representation. Can you do it faster?

Assume that all positive integers are always written without leading zeros.


-----Input-----

The only line of the input contains two integers a and b (1 ≤ a ≤ b ≤ 10^18) — the first year and the last year in Limak's interval respectively.


-----Output-----

Print one integer – the number of years Limak will count in his chosen interval.


-----Examples-----
Input
5 10

Output
2

Input
2015 2015

Output
1

Input
100 105

Output
0

Input
72057594000000000 72057595000000000

Output
26



-----Note-----

In the first sample Limak's interval contains numbers 5_10 = 101_2, 6_10 = 110_2, 7_10 = 111_2, 8_10 = 1000_2, 9_10 = 1001_2 and 10_10 = 1010_2. Two of them (101_2 and 110_2) have the described property.

Difficulty: EASY

Solutions:
(a, b) = map(int, input().split())
candidate = 0
limark_count = 0
for i in range(1, 64):
	ip = 2 ** i
	for j in range(i - 1):
		jp = 2 ** j
		candidate = ip - jp - 1
		if candidate >= a and candidate <= b:
			limark_count += 1
	if candidate >= b:
		break
print(limark_count)


(a, b) = map(int, input().split())
ans = 0
for l in range(2, 65):
	for i in range(l - 1):
		ans += a <= 2 ** l - 1 - 2 ** i <= b
print(ans)


def next(n):
	s = list(str(bin(n))[2:])
	if s[-1] == '0':
		s[-1] = '1'
		s[1] = '0'
		s.append('1')
	else:
		for i in range(n):
			if s[i] == '0':
				s[i] = '1'
				s[i + 1] = '0'
				break
	ans = ''
	for i in s:
		ans += i
	return int(ans, 2)

def norm(n):
	ans = []
	s = list(str(bin(n))[2:])
	for i in range(len(s)):
		if s[i] == '0':
			ans = s[:i + 1]
			break
	while len(ans) < len(s):
		ans.append('1')
	t = ''
	for i in ans:
		t += i
	return int(t, 2)
(a, b) = map(int, input().split())
s = list(str(bin(a))[2:])
if s.count('1') == len(s):
	a += 1
a = norm(a)
ans = 0
while a <= b:
	ans += 1
	a = next(a)
print(ans)


def count(a):
	count = 1
	x = 1
	length = 1
	while x < a:
		x = 2 * x + 1
		count += length
		length += 1
	count -= length - 1
	y = 1
	while 2 * y <= x:
		x ^= y
		if x <= a:
			count += 1
		x ^= y
		y *= 2
	return count
(low, high) = map(int, input().split())
print(count(high) - count(low - 1))


def main():
	tok = input().split()
	A = int(tok[0])
	B = int(tok[1])
	ans = 0
	for a in range(1, 70):
		for b in range(70):
			num = (2 ** a - 1) * 2 ** (b + 1) + (2 ** b - 1)
			if num >= A and num <= B:
				ans += 1
	print(ans)
main()


(a, b) = map(int, input().split())
(x, y) = (0, 0)
res = 0
for i in range(60):
	if a >= 2 ** i and a < 2 ** (i + 1):
		x = i + 1
		break
for i in range(60):
	if b >= 2 ** i and b < 2 ** (i + 1):
		y = i + 1
		break
for i in range(x, y + 1):
	t = 2 ** i - 1
	for j in range(i - 1):
		d = t - 2 ** j
		if d >= a and d <= b:
			res += 1
print(res)


n = 2
(a, b) = map(int, input().split())
c = 0
while 1:
	for v in ['1' * i + '0' + '1' * (n - 1 - i) for i in range(1, n)]:
		if int(v, 2) > b:
			break
		if int(v, 2) >= a:
			c += 1
	else:
		n += 1
		continue
	print(c)
	break


def vten(c, n):
	c = str(c)
	ans = 0
	for i in range(0, len(c)):
		ans += int(c[len(c) - i - 1]) * n ** i
	return ans

def vk(ch, k):
	ans = ''
	while ch != 0:
		ans += str(ch % k)
		ch //= k
	return ans[::-1]
ans = []
for x in range(60):
	for i in range(1, x + 1):
		s = '1' * i
		s += '0'
		s += '1' * (x - i)
		y = vten(int(s), 2)
		ans.append(y)
(a, b) = map(int, input().split())
answer = 0
for i in ans:
	if i >= a and i <= b:
		answer += 1
print(answer)


(a, b) = map(int, input().split())
u = bin(a)
v = bin(b)
a = len(u) - 2
b = len(v) - 2
c = 0
if a == b:
	for i in range(1, a):
		s = '0b' + '1' * i + '0' + '1' * (a - i - 1)
		if u <= s and s <= v:
			c += 1
else:
	for i in range(1, a):
		s = '0b' + '1' * i + '0' + '1' * (a - i - 1)
		if u <= s:
			c += 1
	for i in range(1, b + 1):
		s = '0b' + '1' * i + '0' + '1' * (b - i - 1)
		if s <= v:
			c += 1
	for i in range(a + 1, b):
		c += i - 1
print(c)


(a, b) = map(int, input().split())
(la, lb) = (len(bin(a)) - 2, len(bin(b)) - 1)
cnt = sum(((1 << i) - 1 - (1 << j) in range(a, b + 1) for i in range(la, lb) for j in range(i - 1)))
print(cnt)


import math
(m, n) = list(map(int, input().split()))
a = 0
b = 0
c = 0
d = 0
if m == 1 or m == 2:
	a = 0
elif m == 3:
	a = 1
else:
	p = math.floor(math.log2(m))
	a += p * (p - 1) / 2
	for q in range(p):
		if 2 ** p < 2 ** (p + 1) - 1 - 2 ** q <= m:
			a += 1
			if 2 ** (p + 1) - 1 - 2 ** q == m:
				c = 1
if n == 1:
	b = 0
elif n == 2 or n == 3:
	b = 1
else:
	r = math.floor(math.log2(n))
	b += r * (r - 1) / 2
	for s in range(r):
		if 2 ** r < 2 ** (r + 1) - 1 - 2 ** s <= n:
			b += 1
print(int(b - a + c + d))


(a, b) = map(int, input().split())
List = []
for i in range(2, 61):
	for j in range(i - 2, -1, -1):
		List += [(1 << i) - (1 << j) - 1]
res = 0
for i in List:
	if a <= i and i <= b:
		res += 1
print(res)


def onezero_nums(n):
	n = bin(n)[2:]
	k = len(n)
	s = (k - 1) * (k - 2) // 2 + (n.count('0') == 1)
	r = n.find('0')
	if r == -1:
		s += k - 1
	else:
		s += r - 1
	return s
(a, b) = map(int, input().split())
print(onezero_nums(b) - onezero_nums(a - 1))


(a, b) = map(int, input().split(' '))
(aa, bb) = (bin(a)[2:], bin(b)[2:])
ans = 0
if len(aa) == len(bb):
	s = ['1'] * len(aa)
	for i in range(1, len(s)):
		s[i] = '0'
		ss = int(''.join(s), 2)
		if ss >= a and ss <= b:
			ans += 1
		s[i] = '1'
else:
	s = ['1'] * len(aa)
	for i in range(1, len(s)):
		s[i] = '0'
		ss = int(''.join(s), 2)
		if ss >= a:
			ans += 1
		s[i] = '1'
	s = ['1'] * len(bb)
	for i in range(1, len(s)):
		s[i] = '0'
		ss = int(''.join(s), 2)
		if ss <= b:
			ans += 1
		s[i] = '1'
	for i in range(len(aa) + 1, len(bb)):
		ans += i - 1
print(ans)


(a, b) = map(int, input().split())
sum = 0
c = bin(a)[2:]
d = bin(b)[2:]
l = len(c)
r = len(d)
for i in range(l, r + 1):
	for j in range(0, i - 1):
		if a <= (1 << i) - 1 - (1 << j) <= b:
			sum += 1
print(sum)


gen = []
for i in range(1, 70):
	x = (1 << i) - 1
	for j in range(i - 1):
		gen.append(x ^ 1 << j)
gen = list(set(gen))
(a, b) = map(int, input().split())
ans = 0
for y in gen:
	if a <= y <= b:
		ans += 1
print(ans)


(a, b) = map(int, input().split())
cnt = 0
for i in range(2, 65):
	for j in range(i - 1):
		r = 2 ** i - 2 ** j - 1
		if a <= r <= b:
			cnt += 1
print(cnt)


from math import log2, floor

def bits(size, a, b):
	(count, val) = (0, 0)
	no = 2 ** size - 1
	for i in range(size - 1):
		val = no - 2 ** i
		if a <= val <= b:
			count += 1
	return count

def main():
	(a, b) = [int(x) for x in input().split()]
	ans = 0
	l = floor(log2(a) + 1)
	h = floor(log2(b) + 1)
	for i in range(l, h + 1):
		ans += bits(i, a, b)
	print(ans)
main()


def f(x):
	res = 0
	for i in range(64):
		for j in range(i + 1, 64):
			t = 0
			for k in range(j + 1):
				if k != i:
					t += 1 << k
			if t <= x:
				res += 1
	return res

def main():
	(a, b) = [int(i) for i in input().split()]
	print(f(b) - f(a - 1))
main()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(a, b) = map(int, input().split())
	s = set()
	for i in range(2, 70):
		x = 2 ** i - 1
		for j in range(1, i):
			v = x - 2 ** (j - 1)
			s.add(v)
	ans = 0
	for i in s:
		if a <= i <= b:
			ans += 1
	print(ans)
main()


(a, b) = map(int, input().split())
cnt = 0
for i in range(2, 65):
	for j in range(i - 1):
		cur = 0
		for k in range(i):
			cur = cur + (k != j) * (1 << k)
		if cur >= a and cur <= b:
			cnt += 1
print(cnt)


s = 0
(a, b) = map(int, input().split())
for i in range(0, 63):
	if 2 ** i - 2 ** (i - 2) - 1 > b:
		break
	for j in range(0, i - 1):
		if a <= 2 ** i - 2 ** j - 1 <= b:
			s += 1
print(s)


(x, y) = map(int, input().split())
c = 0
for i in range(63):
	for j in range(i - 1):
		if x <= 2 ** i - 1 - 2 ** j <= y:
			c += 1
print(c)


(a, b) = map(int, input().split())
d = {1: 0}
for i in range(2, 61):
	d[2 ** i - 1] = d[2 ** (i - 1) - 1] + i - 1

def check(a):
	ans = 0
	for i in range(1, 61):
		if 2 ** i - 1 <= a:
			ans = d[2 ** i - 1]
		else:
			break
	val1 = 2 ** (i - 1)
	val2 = 2 ** i - 1
	for j in range(61):
		if val2 - 2 ** j >= val1 and val2 - 2 ** j <= a:
			ans += 1
	return ans
print(check(b) - check(a - 1))


(a, b) = map(int, input().split())
print(sum((2 ** i - 1 ^ 2 ** j in range(a, b + 1) for i in range(2, 65) for j in range(i - 1))))


input_ = input().split(' ')
input_numbers = list(map(int, input_))
shifted_ = []
a = input_numbers[0]
b = input_numbers[1]
a_ = len(bin(a)[2:])
b_ = len(bin(b)[2:])
all_ = []
answers = []

def generate_answers(mask):
	binaries = []
	for i in range(2, len(mask)):
		aux = '0b'
		aux += mask[2:]
		aux = list(aux)
		aux[i] = '0'
		aux = ''.join(aux)
		binaries.append(aux)
	return binaries
for i in range(a_, b_ + 1):
	shifted = (1 << i) - 1
	shifted_.append(bin(shifted))
for i in shifted_:
	all_ += generate_answers(i)
for i in all_:
	number = int(i, 2)
	if not (number < input_numbers[0] or number > input_numbers[1] or i[2] == '0'):
		answers.append(i)
print(len(answers))


(a, b) = map(int, input().split())
r = 0
for i in range(2, 64):
	z = 2 ** i - 1
	for j in range(i - 1):
		x = z - 2 ** j
		if x >= a and x <= b:
			r += 1
print(r)


from sys import stdin, stdout
import sys
from bisect import bisect_left, bisect_right
(a, b) = stdin.readline().strip().split(' ')
(a, b) = (int(a), int(b))
farr = []
for total_bits in range(64):
	arr = [(1 << total_bits) - 1 for _ in range(total_bits)]
	for i in range(len(arr)):
		arr[i] = arr[i] ^ 1 << i
	for i in range(len(arr) - 1):
		farr.append(arr[i])
farr.sort()
t1 = bisect_left(farr, a)
t2 = bisect_right(farr, b)
stdout.write(str(t2 - t1) + '\n')


(a, b) = map(int, input().split())
p = []
for n in range(1, 70):
	cur = 2 ** n + 2 ** (n - 1) - 1
	k = n - 2
	p.append(cur)
	while k >= 0:
		cur += 2 ** k
		k -= 1
		p.append(cur)
cnt = sum((a <= i <= b for i in p))
print(cnt)


(a, b) = map(int, input().split())
binA = ''
binB = ''
while a > 0:
	binA = str(a % 2) + binA
	a = a // 2
while b > 0:
	binB = str(b % 2) + binB
	b = b // 2
lenA = len(binA)
lenB = len(binB)
i = binA.find('0')
if i == -1:
	i = lenA
if binB.count('0') == 1:
	j = binB.find('0')
elif binB.count('0') == 0:
	j = lenB - 1
else:
	j = binB.find('0') - 1
if lenA != lenB:
	ret = lenA - i + j
	for k in range(lenA + 1, lenB):
		ret += k - 1
	print(ret)
elif j < i:
	print(0)
else:
	print(j - i + 1)


ii = lambda : int(input())
kk = lambda : map(int, input().split())
ll = lambda : list(kk())
c = 0
(a, b) = kk()
for i in range(61):
	for j in range(1, i):
		v = int(''.join(['0' if k == j else '1' for k in range(i)]), 2)
		if a <= v <= b:
			c += 1
print(c)


x = input().split()
ans = 0
for i in range(61):
	for j in range(i - 1):
		y = 2 ** i - 1 - 2 ** j
		if y >= int(x[0]) and y <= int(x[1]):
			ans += 1
print(ans)


(x, y) = list(map(int, input().split()))
h = len(bin(x)) - 3
m = len(bin(y)) - 1
c = 0
for i in range(h, m + 1):
	a = 2 ** i - 1
	k = 0
	for j in range(i - 1):
		k = a - 2 ** j
		if k >= x and k <= y:
			c += 1
print(c)


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(a, b) = int_array()
bb = '0' + bin(b).replace('0b', '')
bx = len(bb)
ans = 0
for i in range(bx):
	this = ['1'] * (i + 1)
	for j in range(1, i + 1):
		this[j] = '0'
		s = ''.join(this)
		year = int(s, 2)
		if year <= b and year >= a:
			ans += 1
		this[j] = '1'
print(ans)


def main():
	(a, b) = (int(x) for x in input().split())
	print(solver(a, b))

def solver(a, b):
	binA = bin(a)[2:]
	binB = bin(b)[2:]
	startA = len(binA)
	for i in range(len(binA)):
		if binA[i] == '0':
			startA = i
			break
	startB = len(binB)
	for i in range(len(binB)):
		if binB[i] == '0':
			startB = i
			break
	bValid = False
	if startB != len(binB) and binB[startB + 1:] == '1' * (len(binB) - startB - 1):
		bValid = True
	total = 0
	if len(binA) != len(binB):
		total += len(binA) - startA + startB - 1
		if bValid == True:
			total += 1
	elif binA == binB:
		if bValid == True:
			return 1
		else:
			return 0
	else:
		total += startB - startA
		if bValid == True:
			total += 1
	for i in range(len(binA) + 1, len(binB)):
		total += i - 1
	if total < 0:
		return 0
	else:
		return total
main()


def main():
	(a, b) = map(int, input().split())
	res = x = 0
	for le in range(b.bit_length()):
		(x, mask) = (x * 2 + 1, 1)
		for _ in range(le):
			res += a <= x ^ mask <= b
			mask *= 2
	print(res)
main()


from math import *

def bindec(ch):
	r = 0
	p = 1
	n = len(ch)
	for k in range(n):
		r += int(ch[n - 1 - k]) * p
		p *= 2
	return r
(a, b) = list(map(int, input().split()))
la = int(log(a, 2)) + 1
lb = int(log(b, 2)) + 1
r = 0
ch = ''
for k in range(la, lb + 1):
	for i in range(1, k):
		ch = '1' * i + '0' + '1' * (k - i - 1)
		if bindec(ch) > b:
			break
		elif bindec(ch) >= a:
			r += 1
print(r)


def getbit(n, k):
	return n >> k & 1

def sum(n):
	return n * (n + 1) // 2

def Cal(n):
	if n == 0:
		return 0
	end = 63
	while n < 1 << end:
		end -= 1
	cnt = 0
	rs = 0
	first = end
	while end >= 0:
		if getbit(n, end) == 1:
			if cnt == 0:
				if end == first:
					rs += max(0, sum(end - 1))
				else:
					rs += 1
		else:
			cnt += 1
			if cnt > 1:
				break
		end -= 1
	if cnt == 1:
		rs += 1
	return rs
(a, b) = map(int, input().split())
print(Cal(b) - Cal(a - 1))


while True:
	try:

		def soln(l, r):
			ans = set()
			for i in range(1, 63, 1):
				v = (1 << i) - 1
				for j in range(0, i - 1, 1):
					ans.add(v ^ 1 << j)
			cunt = 0
			for x in ans:
				if x >= l and x <= r:
					cunt += 1
			print(cunt)

		def read():
			(l, r) = map(int, input().split())
			soln(l, r)
		if __name__ == '__main__':
			read()
	except EOFError:
		break


line1 = [int(x) for x in input().split()]
a = line1[0]
b = line1[1]
i = 1
total = 0
while 2 ** i - 1 < a:
	i += 1
while 2 ** i - 1 <= b * 2:
	temp = 2 ** i - 1
	for j in range(0, i - 1):
		if temp - 2 ** j >= a and temp - 2 ** j <= b:
			total += 1
	i += 1
print(total)


def isPow2(v):
	return v & v - 1 == 0

def roundUpToHole(n):
	next_pow_2 = 2 ** n.bit_length() - 1
	rem = next_pow_2 - n
	if rem == 0:
		return n + (next_pow_2 + 1) - (next_pow_2 + 1) // 2
	rem2 = 2 ** (rem.bit_length() - 1)
	n2 = next_pow_2 - rem2
	return n2
(a, b) = map(int, input().split())
i = roundUpToHole(a)
bitlen = i.bit_length()
count = 0
while i <= b:
	count += 1
	next_pow_2 = 2 ** bitlen - 1
	rem = next_pow_2 - i
	if rem > 1:
		i += rem
		i -= rem // 2
	elif rem == 1:
		i += rem
		i += next_pow_2 + 1
		i -= (next_pow_2 + 1) // 2
		bitlen += 1
	else:
		assert False
print(count)


(a, b) = map(int, input().split())
answer = 0
l = []
for x in range(1, 64):
	num = 2 ** x - 1
	for y in range(0, x + 1):
		if num - 2 ** y >= a and num - 2 ** y <= b and (num - 2 ** y not in l) and (bin(num - 2 ** y)[2:].count('0') == 1):
			l.append(num - 2 ** y)
			answer += 1
print(answer)


(a, b) = map(int, input().split())
c = bin(a)[2:]
d = bin(b)[2:]
t1 = len(c)
t2 = len(d)
ans = 0
for i in range(t1, t2 + 1):
	for j in range(0, i - 1):
		if (1 << i) - 1 - (1 << j) in range(a, b + 1):
			ans += 1
print(ans)


(a, b) = map(int, input().split())
count = 0
for i in range(2, 62):
	s = 2 ** i - 1
	for j in range(i - 1):
		n = s - 2 ** j
		if a <= n and n <= b:
			count += 1
print(count)


import math
(a, b) = map(int, input().split())
r1 = int(math.log(a) / math.log(2) + 1)
r2 = int(math.log(b) / math.log(2) + 1)
ct = 0
for k in range(r1, r2 + 1):
	e = 2 ** k - 1
	for i in range(k - 1):
		if a <= e - 2 ** i <= b:
			ct += 1
print(ct)


a = []
for i in range(1, 62):
	for j in range(i):
		a.append(int('1' * (i - j) + '0' + '1' * j, base=2))
(x, y) = map(int, input().split())
print(len(list(filter(lambda d: x <= d and d <= y, a))))


(n, m) = map(int, input().split(' '))
ans = 0
for i in range(100):
	for j in range(1, i):
		s = [1] * i
		s[j] = 0
		v = int(''.join(map(str, s)), 2)
		if v < n:
			ans -= 1
		if v <= m:
			ans += 1
print(ans)


def dec_to_bin(n):
	ans = ''
	while n > 0:
		ans += str(n % 2)
		n //= 2
	return ans[::-1]
(a, b) = map(int, input().split())
binaries = [10]
for i in range(2, 61):
	s = i * '1'
	for k in range(1, i + 1):
		s = s[:k] + '0' + s[k:]
		binaries.append(s)
		s = s[:k] + s[k + 1:]
abin = int(dec_to_bin(a))
bbin = int(dec_to_bin(b))
binaries = sorted(list(map(int, set(binaries))))
ans = 0
for j in range(len(binaries)):
	if bbin >= binaries[j] >= abin:
		ans += 1
print(ans)


def convb(s):
	ans = 0
	mul = 1
	l = s[::-1]
	for i in range(len(l)):
		ans += mul * int(l[i])
		mul *= 2
	return ans
(a, b) = map(int, input().split())
la = len(str(bin(a))) - 2
lb = len(str(bin(b))) - 2
ans = []
for k in range(la, lb + 1):
	lla = ['1' for i in range(k)]
	for i in range(1, k):
		if convb(lla[:i] + ['0'] + lla[i + 1:]) <= b and convb(lla[:i] + ['0'] + lla[i + 1:]) >= a:
			ans.append(convb(lla[:i] + ['0'] + lla[i + 1:]))
print(len(set(ans)))


(n, m) = map(int, input().split())
a = bin(n)
b = bin(m)
k = 0
if len(a) == len(b):
	c = 0
	g = 0
	for i in range(3, len(b)):
		if c == 0 and b[i] == '1' and (a[i] == '0') or (c == 0 and b[i] == '1' and (g == 1)):
			k = k + 1
			g = 1
		if b[i] == '0':
			c = 1
			f = i
			break
	if c == 1:
		a = str(a)
		b = str(b)
		if g == 1 and '0' not in b[f + 1:]:
			k = k + 1
		if g == 0 and '0' not in b[f + 1:] and ('1' not in a[f + 1:]):
			k = k + 1
	if a == b and a.count('0') == 2 and (k == 0):
		k = 1
	if k == 0 and b.count('0') == 2:
		k = 1
	print(k)
else:
	k = len(a) - 2
	for i in range(2, len(a)):
		if a[i] == '1':
			k = k - 1
		else:
			break
	t = len(a) + 1
	while t != len(b):
		k = k + t - 3
		t = t + 1
	f = 0
	for i in range(3, len(b)):
		if b[i] == '1':
			k = k + 1
		else:
			f = i
			break
	if '0' not in b[f + 1:] and f != 0:
		k = k + 1
	print(k)


(a, b) = map(int, input().split())
cnt = 0
for i in range(1, 64):
	k = (1 << i) - 1
	for j in range(0, i - 1):
		num = k - (1 << j)
		if a <= num and num <= b:
			cnt += 1
print(cnt)


def tobin(s):
	res = 0
	l = len(s)
	for i in range(l):
		res += int(s[-i - 1]) * 2 ** i
	return res
(n, m) = tuple(map(int, input().split()))
lis = []
for i in range(1, 61):
	for j in range(i):
		lis.append(tobin('1' + '1' * j + '0' + '1' * (i - j - 1)))
i = 0
while n > lis[i]:
	i += 1
j = 0
while m >= lis[j]:
	j += 1
print(j - i)


s = [int(i) for i in input().split()]
x = s[0]
y = s[1]
count = 0
n1 = ''
while x > 0:
	m = str(x % 2)
	n1 = m + n1
	x = int(x / 2)
x = s[0]
y = s[1]
for i in range(len(n1) - 1):
	if 2 ** len(n1) - 2 ** i - 1 >= x and 2 ** len(n1) - 2 ** i - 1 <= y:
		count += 1
if 2 ** len(n1) <= y:
	n2 = ''
	while y > 0:
		m = str(y % 2)
		n2 = m + n2
		y = int(y / 2)
	x = s[0]
	y = s[1]
	for i in range(len(n2) - 1):
		if 2 ** len(n2) - 2 ** i - 1 <= y:
			count += 1
	if len(n2) - len(n1) >= 2:
		count += (len(n1) + len(n2) - 2) * (len(n2) - len(n1) - 1) // 2
print(count)


import math
data = input()
start = int(data[:data.find(' ')])
end = int(data[data.find(' ') + 1:])
output = 0
length_start = int(start.bit_length())
length_end = int(end.bit_length())
length_diff = int(length_end - length_start)
maximum = int(math.pow(2, length_end)) - 1
for j in range(1, length_diff + 2):
	for i in range(length_end - j):
		diff = maximum - int(math.pow(2, i))
		if (diff >= start) & (diff <= end):
			output += 1
	maximum = maximum - int(math.pow(2, length_end - j))
print(output)


def get_total_single_zeroed_number(length):
	return length - 1

def get_all_single_zeroed_numbers(length):
	return [generate_single_zero_number(length, zero_position) for zero_position in range(1, length)]

def generate_single_zero_number(length, zero_position):
	return '1' * zero_position + '0' + '1' * (length - zero_position - 1)

def get_total_same_length_single_zeroed_number_in_between(start, end):
	all_single_zeroed_numbers = get_all_single_zeroed_numbers(len(start))
	return sum((1 for number in all_single_zeroed_numbers if start <= number <= end))

def main():
	(start, end) = [bin(int(t))[2:] for t in input().split()]
	if len(start) == len(end):
		print(get_total_same_length_single_zeroed_number_in_between(start, end))
		return
	total_single_zeroed_number_in_range = 0
	for length in range(len(start) + 1, len(end)):
		total_single_zeroed_number_in_range += get_total_single_zeroed_number(length)
	total_single_zeroed_number_in_range += get_total_same_length_single_zeroed_number_in_between(start, '1' * len(start))
	total_single_zeroed_number_in_range += get_total_same_length_single_zeroed_number_in_between('0' * len(end), end)
	print(total_single_zeroed_number_in_range)
main()


(l, r) = map(int, input().split())
a = []
for ln in range(1, 64):
	for i in range(1, ln):
		buf = list('1' * ln)
		buf[i] = '0'
		a.append(int(''.join(buf), 2))
ans = 0
for v in a:
	if l <= v <= r:
		ans += 1
print(ans)


ans = 0
(a, b) = list(map(int, input().split()))
l = 2
pos = l - 2
ans = 0
while True:
	n = (1 << l) - 1 - (1 << pos)
	if n > b:
		break
	if n >= a:
		ans += 1
	if pos > 0:
		pos -= 1
	else:
		l += 1
		pos = l - 2
print(ans)


(n, m) = map(int, input().split())
a = len(bin(n)) - 2
b = len(bin(m)) - 2
count = 0
for i in range(a, b + 1):
	for j in range(i - 1):
		if n <= 2 ** i - 1 - 2 ** j <= m:
			count += 1
print(count)


(a, b) = map(int, str.split(input()))
(sa, sb) = map('{:b}'.format, (a, b))
count = 0
for l in range(len(sa), len(sb) + 1):
	for left in range(1, l):
		s = '1' * left + '0' + '1' * (l - left - 1)
		x = int(s, 2)
		if a <= x <= b:
			count += 1
print(count)


s = input().split()
a = int(s[0])
b = int(s[1])
res = []
for i in range(1, 61):
	for y in range(1, i + 1):
		mas = [1] * i
		mas.insert(y, 0)
		mas = mas[::-1]
		re = 0
		for r in range(i + 1):
			re = re + mas[r] * 2 ** r
		res.append(re)
summ = 0
for i in range(len(res)):
	if res[i] >= a and res[i] <= b:
		summ = summ + 1
print(summ)


(n, m) = map(int, input().split())
cnt = 0
for i in range(2, 65):
	y = pow(2, i)
	for j in range(i - 1):
		z = pow(2, j)
		x = y - z - 1
		if x >= n and x <= m:
			cnt += 1
print(cnt)


(aa, b) = map(int, input().split(' '))
ansss = 0
for i in range(100):
	for j in range(1, i):
		s = [1] * i
		s[j] = 0
		v = int(''.join(map(str, s)), 2)
		if v < aa:
			ansss -= 1
		if v <= b:
			ansss += 1
print(ansss)


'__author__' == 'deepak Singh Mehta(learning to code :) ) '
(a, b) = map(int, input().split())
ans = 0
for i in range(2, 100):
	x = (1 << i) - 1
	for j in range(i - 1):
		y = x ^ 1 << j
		if a <= y and y <= b:
			ans += 1
print(ans)


[a, b] = list(map(int, input().split()))
choto = a
boro = b
a = bin(a)
a = list(a[2:])
b = bin(b)
b = list(b[2:])
x = len(a)
y = len(b)
ans = 0
for i in range(x, y + 1):
	ini = 2 ** i - 1
	for j in range(i - 1):
		now = ini - 2 ** j
		if now >= choto and now <= boro:
			ans += 1
print(ans)


from math import log2 as lg
(a, b) = [int(p) for p in input().split()]
arr1 = []
arr2 = []
i = 0
while 2 ** i < 10 ** 20:
	arr1.append(2 ** i - 1)
	i += 1
for i in range(len(arr1)):
	arr2.append(arr1[i] + 1)
count = 0
arr1.pop(0)
for i in range(len(arr1)):
	for j in range(i):
		if a <= arr1[i] - arr2[j] <= b:
			count += 1
print(count)


(a, b) = list(map(int, input().split()))
ret = set()
for x in range(1, 100):
	mask = 2 ** x - 1
	for j in range(x - 1):
		ll = mask - 2 ** j
		if a <= ll and ll <= b:
			ret.add(ll)
print(len(ret))


(a, b) = list(map(int, input().split()))
maxL = 60
sol = 0
for l in range(1, maxL + 1):
	for p in range(1, l + 1):
		binYear = '1' * p + '0' + (l - p) * '1'
		decYear = int(binYear, 2)
		if a <= decYear and decYear <= b:
			sol += 1
print(sol)


(a, b) = map(int, input().split())
x = bin(a)[2:]
y = bin(b)[2:]
n = len(y)
res = 0
for i in range(len(x), len(y) + 1, 1):
	ans = '1' * i
	cnt = 1
	while cnt != i:
		val = int(ans[:abs(i - cnt)] + '0' + ans[i - cnt + 1:], 2)
		if val >= a and val <= b and (bin(val)[2:].count('0') == 1):
			res += 1
		cnt += 1
print(res)


res = 0
line = input().split()
a = int(line[0])
b = int(line[1])
bin_a = str(bin(a))[2:]
bin_b = str(bin(b))[2:]
cap = 2 ** len(bin_a)
gyro = cap - 2
for i in range(len(bin_a) - 1):
	res += 1 if gyro >= a and gyro <= b else 0
	gyro = (gyro << 1) % cap + 1
if len(bin_a) == len(bin_b):
	print(res)
else:
	cap = 2 ** len(bin_b)
	gyro = cap - 2
	for i in range(len(bin_b) - 1):
		res += 1 if gyro >= a and gyro <= b else 0
		gyro = (gyro << 1) % cap + 1
	for i in range(len(bin_a) + 1, len(bin_b)):
		res = res + i - 1
	print(res)


(a, b) = map(int, input().split())
n = 0
for i in range(1, 64):
	for j in range(64):
		f = '1' * i + '0' + '1' * j
		if a <= int(f, 2) <= b:
			n += 1
print(n)


(u, v) = [int(x) for x in input().split()]
ans = 0
ub = bin(u)[2:]
vb = bin(v)[2:]
if len(ub) == len(vb):
	for i in range(1, len(ub)):
		s = ['1'] * len(ub)
		s[i] = '0'
		s = ''.join(s)
		if int(s, 2) <= v and int(s, 2) >= u:
			ans += 1
	print(ans)
else:
	for i in range(1, len(ub)):
		s = ['1'] * len(ub)
		s[i] = '0'
		s = ''.join(s)
		if int(s, 2) >= u:
			ans += 1
	for i in range(1, len(vb)):
		s = ['1'] * len(vb)
		s[i] = '0'
		s = ''.join(s)
		if int(s, 2) <= v:
			ans += 1
	for i in range(len(ub) + 1, len(vb)):
		ans = ans + i - 1
	print(ans)


import sys
input = sys.stdin.readline
(a, b) = list(map(int, input().split()))
minones = len(bin(a)[2:])
maxones = len(bin(b)[2:])
count = 0
for i in range(minones, maxones + 1):
	ones = '1' * i
	total = int(ones, 2)
	for j in range(1, i):
		val = total - 2 ** (i - 1 - j)
		if val >= a and val <= b:
			count += 1
print(count)


(a, b) = map(int, input().split())
a = bin(a)[2:]
b = bin(b)[2:]
c = -1
d = -1
for i in range(len(a)):
	if a[i] == '0' and c == -1:
		c = i
	if b[i] == '0' and d == -1:
		d = i
ans = 0
if c == -1:
	a = bin(int(a, 2) + 1)[2:]
	c = 1
if d == -1:
	d = len(b) - 1
i = c
s = '1' * len(a)
s = bin(int(s, 2) & ~(1 << len(s) - i - 1))[2:]
while int(s, 2) <= int(b, 2):
	ans += 1
	s = bin(int(s, 2) | 1 << len(s) - i - 1)[2:]
	i += 1
	if i == len(s):
		i = 1
		s = '1' + s
	s = bin(int(s, 2) & ~(1 << len(s) - i - 1))[2:]
print(ans)


def count_special_years(n):
	if n < 0:
		n *= -1
	if n < 2:
		return 0
	i = 0
	j = 1
	while True:
		j = j << 1
		if j > n:
			break
		i += 1
	mask = 1 << i
	x = 1
	for j in range(i):
		x = (x << 1) + 1
	x ^= mask >> 1
	k = 0
	if n >= x:
		k += 1
	for j in range(i - 1):
		x = x >> 1 ^ mask
		if x > n:
			break
		k += 1
	return int(i * (i - 1) / 2) + k
(a, b) = map(int, input().split(' '))
print(count_special_years(b) - count_special_years(a - 1))


import collections
import random
import sys
try:
	from tqdm import tqdm
except:

	def tqdm(iterable):
		return iterable
__taskname = ''
if __taskname:
	sys.stdin = open(__taskname + '.in')
	sys.stdout = open(__taskname + '.out', 'w')

def f(n):
	result = set()
	i = 0
	while 1 << i <= 4 * n:
		for j in range(i - 1):
			if (1 << i) - 1 - (1 << j) <= n:
				result.add((1 << i) - 1 - (1 << j))
		i += 1
	return len(result)
(a, b) = list(map(int, input().split()))
print(f(b) - f(a - 1))


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
(a, b) = map(int, input().split())
count = 0
bia = bin(a)[2:]
bib = bin(b)[2:]
if a == b:
	if bia.count('0') == 1:
		count += 1
elif len(bia) != len(bib):
	z = len(bia)
	for i in list(bia):
		if i == '1':
			z -= 1
		else:
			break
	count += z
	z = -1
	for i in list(bib):
		if i == '1':
			z += 1
		else:
			break
	count += z
	if bib.count('0') == 1:
		count += 1
	if len(bia) + 1 == len(bib):
		pass
	else:
		x = len(bib) - 2
		count += x * (x + 1) // 2 - len(bia) * (len(bia) - 1) // 2
else:
	z = len(bia)
	for i in list(bia):
		if i == '1':
			z -= 1
		else:
			break
	count += z
	z = len(bib)
	for i in list(bib):
		if i == '1':
			z -= 1
		else:
			break
	count -= z
	if bib.count('0') == 1:
		count += 1
print(count)


countYears = 0

def newYearCount(startYear, endYear, baseYear, zeros):
	global countYears
	if baseYear > endYear:
		return None
	if startYear <= baseYear and baseYear <= endYear and (zeros == 1):
		countYears += 1
	if zeros == 0:
		newYearCount(startYear, endYear, baseYear << 1, zeros + 1)
	newYearCount(startYear, endYear, (baseYear << 1) + 1, zeros)
(startYear, endYear) = map(int, input().split())
newYearCount(startYear, endYear, 1, 0)
print(countYears)


(a, b) = map(int, input().split(' '))
ans = 0
for i in range(100):
	for j in range(1, i):
		s = [1] * i
		s[j] = 0
		v = int(''.join(map(str, s)), 2)
		if v < a:
			ans -= 1
		if v <= b:
			ans += 1
print(ans)


(l, r) = map(int, input().split())
ans = 0
binl = bin(l)[2:]
binr = bin(r)[2:]
st = len(binl)
ed = len(binr)
for i in range(st, ed + 1):
	for j in range(0, i - 1):
		if l <= (1 << i) - 1 - (1 << j) <= r:
			ans += 1
print(ans)


x = input().split()
hazZero = False
binary = bin(int(x[0]))
binary = binary[2:]
for i in range(len(binary)):
	if binary[i] == '0':
		hazZero = True
if not hazZero:
	binary = bin(int(x[0]) + 1)
	binary = binary[2:]
isFirst = True
new_binary = ''
for i in range(len(binary)):
	if binary[i] == '0':
		if isFirst:
			new_binary = new_binary + '0'
			isFirst = False
		else:
			new_binary = new_binary + '1'
	else:
		new_binary = new_binary + binary[i]
inDecimal = int(new_binary, 2)
total = 0
while int(x[0]) <= inDecimal and inDecimal <= int(x[1]):
	total += 1
	if new_binary == '1':
		total -= 1
		new_binary = '10'
	elif new_binary[-1] == '0':
		new_binary = '10' + new_binary[:-1]
	else:
		new_binary = '1' + new_binary[:-1]
	inDecimal = int(new_binary, 2)
print(total)


(a, b) = map(int, input().split())
(c, d, e) = (0, 0, ['0'])
for i in range(65):
	for j in range(1, i):
		e.append('1' * j + '0' + '1' * (i - j - 1))
for i in range(0, len(e) - 1):
	if a - 1 >= int(e[i], 2) and a - 1 < int(e[i + 1], 2):
		c = i
for i in range(0, len(e) - 1):
	if b >= int(e[i], 2) and b < int(e[i + 1], 2):
		d = i
print(d - c)


import re
(a, b) = map(lambda x: bin(int(x))[2:], input().split())
cal = lambda x: (len(x) - 2) * (len(x) - 1) // 2
numa = cal(a)
for i in a:
	if i != '1':
		break
	numa += 1
numb = cal(b)
for i in b:
	if i != '1':
		break
	numb += 1
print(numb - numa + (1 if len(re.findall('0', b)) == 1 else 0))


(a, b) = [int(x) for x in input().split()]
answer = 0
if a == 1 and b == 1:
	print(0)
else:
	power = 2
	while power < 61:
		fullones = 2 ** power - 1
		tosubtract = 1
		pos = 1
		while pos < power:
			test = fullones - tosubtract
			if test >= a and test <= b:
				answer += 1
			tosubtract *= 2
			pos += 1
		power += 1
	print(answer)


from sys import *
import math
input = stdin.readline
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())
sJoin = lambda a, sep: f'{sep}'.join(a)
arrJoin = lambda a, sep: f'{sep}'.join(map(str, a))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def main():
	(a, b) = lineInput()
	low = int(math.log2(a))
	high = int(math.log2(b))
	bin_a = bin(a)[2:]
	bin_b = bin(b)[2:]
	mini = min(len(bin_a), len(bin_b))
	maxi = max(len(bin_a), len(bin_b))
	minbit = ['1'] * mini
	maxibit = ['1'] * maxi
	c = 0
	for i in range(1, mini):
		temp = minbit.copy()
		temp[i] = '0'
		if int(''.join(temp), 2) > b:
			break
		elif a <= int(''.join(temp), 2) <= b:
			c += 1
	if mini < maxi:
		for i in range(1, maxi):
			temp = maxibit.copy()
			temp[i] = '0'
			if int(''.join(temp), 2) > b:
				break
			else:
				c += 1
	dif = maxi - mini
	if dif > 1:
		c += (dif - 1) * (mini + (maxi - 2)) // 2
	print(c)
main()


import math

def gen(n):
	help = 0
	for i in range(len(n) - 1, -1, -1):
		help += 2 ** (len(n) - i - 1) * int(n[i])
	return help
(start, finish) = map(int, input().split())
answer1 = 0
b = math.ceil(math.log(finish, 2))
for i in range(1, b + 1):
	n = '1' * i + '0'
	for j in range(i - 1):
		n = '1' * (i - j - 1) + '0' + j * '1'
		help = gen(n)
		if help >= start and help <= finish:
			answer1 += 1
if finish == 2:
	print(1)
else:
	print(answer1)


def possible_answers(n_bits):
	initial = ['1'] * n_bits
	for i in range(1, n_bits):
		yield ''.join(initial[:i] + ['0'] + initial[i + 1:])

def solution(y1, y2):
	(y1_bits, y2_bits) = ('{:0b}'.format(y1), '{:0b}'.format(y2))
	(len_y1_b, len_y2_b) = (len(y1_bits), len(y2_bits))
	output = 0
	n_base10 = 0
	for word_length in range(len_y1_b, len_y2_b + 1):
		for p_answer in possible_answers(word_length):
			n_base10 = int(p_answer, base=2)
			if n_base10 < y1:
				continue
			if n_base10 >= y1 and n_base10 <= y2:
				output += 1
			if n_base10 > y2:
				break
		if n_base10 > y2:
			break
	return output
(start, end) = map(int, input().split())
print(solution(start, end))


x = input('').split(' ')
a = int(x[0])
b = int(x[1])
pow2 = []
for g in range(66):
	pow2.append(1 << g)

def solve(c):
	cnt = 0
	for g in range(66):
		k = 0
		for y in range(g):
			k |= 1 << y
		for y in range(g + 1, 66):
			k |= 1 << y
			if k <= c:
				cnt += 1
	return cnt
print(solve(b) - solve(a - 1))


(a, b) = map(int, input().split())
ans = 0
for i in range(1, 70):
	for j in range(0, 70):
		cnt = (2 ** i - 1) * 2 ** (j + 1) + (2 ** j - 1)
		if cnt >= a and cnt <= b:
			ans += 1
print(ans)


__author__ = 'Utena'
(a, b) = map(int, input().split())
n = 2
t = 0
n1 = 1
c = 0
while True:
	if n1 > b:
		break
	else:
		n *= 2
		n1 = n - 1
		c += 1
		n2 = 1
		for i in range(c):
			if n1 - n2 >= a and n1 - n2 <= b:
				t += 1
			n2 *= 2
print(t)


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_i():
	return map(int, sys.stdin.readline().split())
from bisect import bisect_left
import sys

def fxn(st, en, ind, step):
	mid = st + (en - st) // 2
	if ind < mid:
		return fxn(st, mid - 1, ind, step - 1)
	elif ind > mid:
		return fxn(mid + 1, en, ind, step - 1)
	else:
		return step
import sys
(a, b) = get_i()
cnt = 0
for i in range(63):
	for j in range(i - 1):
		if a <= 2 ** i - 1 - 2 ** j <= b:
			cnt += 1
print(cnt)


from math import *
(a, b) = map(int, input().split())
count = 0
for i in range(1, 64):
	for j in range(64):
		san = '1' * i + '0' + '1' * j
		if a <= int(san, 2) <= b:
			count += 1
print(count)


(x, y) = input().split()
x = int(x)
y = int(y)
total = 0
i = 0
while (1 << i) // 2 <= y:
	j = 0
	while j <= i - 2:
		value = (1 << i) - 1 - (1 << j)
		if x <= value and value <= y:
			total += 1
		j += 1
	i += 1
print(total)


def compute(a):
	b = bin(a)[2:]
	n = len(b) - 1
	res = n * (n - 1) // 2
	zero_cnt = b.count('0')
	if zero_cnt == 1:
		res += 1
	res += b.index('0') - 1 if zero_cnt > 0 else n
	return res

def main():
	(a, b) = map(int, input().split())
	res = compute(b) - compute(a - 1)
	print(res)
main()


(a, b) = map(int, input().split())
countYears = 0
for i in range(1, 64):
	m = pow(2, i)
	for j in range(i - 1):
		n = pow(2, j)
		calculate = m - n - 1
		if calculate >= a and calculate <= b:
			countYears += 1
print(countYears)


def binn_c(i):
	if '0' not in str(bin(i))[2:]:
		i -= 1
	g = list(str(bin(i))[2:])
	j = g.index('0')
	if g.count('0') != 1:
		ans = j - 1
	else:
		ans = j
	g.pop()
	while len(g) > 1:
		g.pop()
		ans += len(g)
	return ans

def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [int(x) for x in (f.readline() if mode == 'file' else input()).split()]
	[a, b] = get()
	print(binn_c(b) - binn_c(a - 1))
	if mode == 'file':
		f.close()
main()


import math
(A, B) = map(int, input().split())
count = 0
next_pow = int(math.pow(2, math.ceil(math.log(B + 1, 2))))
y = next_pow - 2
while y >= A:
	delta = ~y & y + 1
	if delta << 2 & y == 0:
		delta += 1
	if A <= y and y <= B:
		count += 1
	y -= delta
print(count)


(a, b) = map(int, input().split())
ans = 0
for i in range(2, 100):
	x = (1 << i) - 1
	for j in range(i - 1):
		y = x ^ 1 << j
		if a <= y and y <= b:
			ans += 1
print(ans)


def clc(n):
	ans = 0
	ns = '{0:b}'.format(n)
	for k in range(1, len(ns)):
		ans += k - 1
	ns = ns[1:]
	while ns:
		if ns[0] == '1':
			ans += 1
			ns = ns[1:]
		else:
			if ns == '0' + '1' * (len(ns) - 1):
				ans += 1
			break
	return ans
(a, b) = map(int, input().split())
ans = clc(b)
if a > 1:
	ans -= clc(a - 1)
print(ans)


(a, b) = map(int, input().split())
ss = 0
for i in range(0, 64):
	for j in range(0, 64):
		s = '1' * i + '0' + '1' * j
		s = str(int(s))
		if s.count('0') and a <= int(s, 2) <= b:
			ss += 1
print(ss)


from itertools import permutations
import sys
if False:
	inp = open('B.txt', 'r')
else:
	inp = sys.stdin

def convert(string):
	ret = 0
	i = 0
	for char in string:
		char = int(char)
		ret += char * 2 ** i
		i += 1
	return ret
power = 0
while 2 ** power <= 10 ** 18:
	power += 1
numbers = []
for i in range(1, power + 1):
	for j in range(i - 1):
		temp = '1' * (i - 1 - j) + '0' + '1' * j
		numbers.append(int(temp, 2))
(a, b) = map(int, inp.readline().split())
ans = 0
for num in numbers:
	if a <= num <= b:
		ans += 1
print(ans)


(a, b) = map(int, input().split())
print(len([2 ** i - 1 - 2 ** j for i in range(65) for j in range(i - 1) if a <= 2 ** i - 1 - 2 ** j <= b]))


def read_list():
	return [int(i) for i in input().split()]

def new_list(n):
	return [0 for i in range(n)]

def new_matrix(n, m=0):
	return [[0 for i in range(m)] for i in range(n)]
(a, b) = read_list()
answ = 0
i = 0
while (1 << i) / 2 <= b:
	j = 0
	while j < i - 1:
		if a <= (1 << i) - 1 - (1 << j) <= b:
			answ += 1
		j += 1
	i += 1
print(answ)


X = list(map(int, input().split()))
Count = 0
for i in range(len(bin(X[0])) - 2, len(bin(X[1])) - 1):
	Temp = 2 ** i - 1
	for j in range(i - 1):
		if Temp - (1 << j) in range(X[0], X[1] + 1):
			Count += 1
print(Count)


(a, b) = map(int, input().split())
res = 0
for i in range(1, 64):
	for j in range(64):
		c = '1' * i + '0' + '1' * j
		if a <= int(c, 2) <= b:
			res += 1
print(res)


(a, b) = map(int, input().split())
r1 = len(bin(a)) - 2
r2 = len(bin(b)) - 2
ans = 0
for i in range(r1 - 1, 0, -1):
	x = ['1'] * r1
	x[i] = '0'
	if a <= int(''.join(x), 2) <= b:
		ans += 1
for i in range(r1 + 1, r2):
	ans += i - 1
if r1 != r2:
	for i in range(r2 - 1, 0, -1):
		x = ['1'] * r2
		x[i] = '0'
		if a <= int(''.join(x), 2) <= b:
			ans += 1
print(ans)


def main():
	(left, r) = map(int, input().split())
	ans = 0
	for l in range(1, 61):
		for i in range(l):
			s = ''
			for j in range(l):
				if i == j:
					s += '0'
				else:
					s += '1'
			x = int(s, 2)
			if bin(x)[2:].count('0') == 1 and left <= x <= r:
				ans += 1
	print(ans)
main()


(a, b) = map(int, input().split())
s = 0
for i in range(1, 61):
	k = ['1'] * i
	for j in range(1, i):
		k[j] = '0'
		if a <= int(''.join(k), 2) <= b:
			s += 1
		k[j] = '1'
print(s)


(a, b) = map(int, input().split())
w = 2
while 2 ** w <= a:
	w += 1
ans1 = 0
for i in range(w - 1):
	ans1 += i
for i in range(w - 1):
	if 2 ** w - 2 ** i <= a:
		ans1 += 1
w = 2
while 2 ** w <= b:
	w += 1
ans2 = 0
for i in range(w - 1):
	ans2 += i
for i in range(w - 1):
	if 2 ** w - 2 ** i <= b:
		ans2 += 1
col = 0
while b != 0:
	if b % 2 == 0:
		col += 1
	b = b // 2
if col == 1:
	ans2 += 1
print(ans2 - ans1)


l = []
for i in range(2, 62):
	x = 2 ** i - 1
	for j in range(i - 1):
		l.append(x - 2 ** j)
(n, m) = map(int, input().split())
ans = 0
for i in l:
	if i <= m and i >= n:
		ans += 1
print(ans)


def zero(strx):
	k = []
	str2 = list(strx)
	for i in range(1, len(str2)):
		str3 = str2[:]
		str3[i] = '0'
		k.append(''.join(str3))
	return k
a = []
for i in range(1, 64):
	a += zero('1' * i)
ct = 0
(x, y) = list(map(int, input().split(' ')))
for i in a:
	if x <= int(i, 2) <= y:
		ct += 1
print(ct)


def to2th(a):
	ans = ''
	while a != 0:
		if a % 2 == 0:
			ans += '0'
		else:
			ans += '1'
		a = a // 2
	return ans[::-1]

def hw(x):
	ps = 0
	for i in range(0, len(x)):
		if x[-1 - i] == '0':
			ps = i + 1
	return ps
(a, b) = map(int, input().split())
a = to2th(a)
b = to2th(b + 1)
if len(a) == len(b):
	print(hw(a) - hw(b))
else:
	ans = hw(a)
	for i in range(len(a) + 1, len(b)):
		ans += i - 1
	ans += len(b) - 1 - hw(b)
	print(ans)


def generate_aswners_from_mask(mask):
	one_zero_binaries = []
	for i in range(2, len(mask)):
		aux_bin = '0b'
		aux_bin += mask[2:]
		aux_bin = list(aux_bin)
		aux_bin[i] = '0'
		aux_bin = ''.join(aux_bin)
		one_zero_binaries.append(aux_bin)
	return one_zero_binaries
input_numbers = input()
input_numbers = input_numbers.split(' ')
input_numbers = list(map(int, input_numbers))
masks = []
a = input_numbers[0]
b = input_numbers[1]
a_sz = len(bin(a)[2:])
b_sz = len(bin(b)[2:])
for i in range(a_sz, b_sz + 1):
	mask = (1 << i) - 1
	masks.append(bin(mask))
all_aswners = []
for i in masks:
	all_aswners = all_aswners + generate_aswners_from_mask(i)
final_aswners = []
for i in all_aswners:
	int_rep = int(i, 2)
	if int_rep < input_numbers[0] or int_rep > input_numbers[1] or i[2] == '0':
		continue
	final_aswners.append(i)
print(len(final_aswners))


(a, b) = map(int, input().split())
low = len(bin(2 ** len(bin(a)[2:]) - 1)[2:])
high = len(bin(2 ** len(bin(b)[2:]) - 1)[2:])
ans = 0
for i in range(low, high + 2):
	c = list(bin(2 ** i - 1)[2:])
	for k in range(1, len(c)):
		c[k] = '0'
		e = ''.join(c)
		num = int(e, 2)
		if num >= a and num <= b:
			ans += 1
		c[k] = '1'
print(ans)


import math
(a, b) = map(int, input().split())
floor = math.ceil(math.log(a + 1, 2))
ceil = math.ceil(math.log(b + 1, 2))
cnt = 0
for i in range(floor, ceil + 1):
	t = pow(2, i) - 1
	for j in range(i - 1):
		if t - pow(2, j) >= a and t - pow(2, j) <= b:
			cnt += 1
print(cnt)


def convert(binary_list):
	ret = 0
	for i in range(len(binary_list)):
		power = 2 ** i
		temp = binary_list[len(binary_list) - 1 - i] * power
		ret += temp
	return ret
s = str(input()).split()
y1 = int(s[0])
y2 = int(s[1])
y1S = str(bin(y1))[2:]
y2S = str(bin(y2))[2:]
count = 0
for i in range(2, len(y2S) + 1):
	for j in range(1, i):
		year = [1] * i
		year[j] = 0
		if y1 <= convert(year) <= y2:
			count += 1
print(count)


(a, b) = [int(x) for x in input().split()]

def rotate(s):
	s = s[1:] + s[0]
	return s
listx = []
for i in range(2, 100):
	s = ''
	for j in range(i - 1):
		s += '1'
	s = s + '0'
	listx.append(s)
	for u in range(105):
		s = rotate(s)
		if s[0] == '0':
			continue
		listx.append(s)
listx = list(set(listx))
listy = []
for i in listx:
	listy.append(int(i, 2))
total = 0
for i in listy:
	if i <= b and i >= a:
		total += 1
print(total)


def main():
	(a, b) = map(int, input().split(' '))
	ret = 0
	for i in range(1, 1000):
		x = (1 << i) - 1
		for j in range(i - 1):
			y = x ^ 1 << j
			if y <= b and y >= a:
				ret += 1
	return ret
print(main())


import math
arr = list(map(int, input().split()))
a = arr[0]
b = arr[1]
r1 = int(math.log(a) / math.log(2) + 1)
r2 = int(math.log(b) / math.log(2) + 1)
t = 0
for k in range(r1, r2 + 1):
	e = 2 ** k - 1
	for i in range(k - 1):
		if a <= e - 2 ** i <= b:
			t += 1
print(t)


import sys

def main():
	(l, r) = map(int, sys.stdin.readline().strip().split())
	count = 0
	for i in range(1, 61):
		x = 2 ** i - 1
		for j in range(i - 1):
			y = 1 << j ^ x
			if y >= l and y <= r:
				count += 1
	print(count)
main()


(a, b) = map(int, input().split())

def upto(n):
	cnt = 0
	b = bin(n)[2:]
	blen = len(b)
	for i in range(2, blen):
		cnt += i - 1
	curr = 2 ** blen - 1
	for i in range(blen):
		a = curr - 2 ** i
		if a <= n:
			cnt += 1
	return cnt
print(upto(b) - upto(a - 1))


from sys import stdin
input = stdin.readline
import math
import sys
sys.setrecursionlimit(10 ** 4)
(a, b) = list(map(int, input().split()))
count = 0
for i in range(0, 61):
	num = (1 << i) - 1
	for j in range(i - 1):
		p = num & ~(1 << j)
		if p <= b and p >= a:
			count += 1
print(count)


(a, b) = map(int, input().split())
r = 0
to_bin = lambda x: '{:b}'.format(x)
while '0' not in to_bin(a):
	a += 1
la = a.bit_length()
t = ['1'] * la
zero_pos = to_bin(a).index('0')
t[zero_pos] = '0'
while int(''.join(t), 2) <= b:
	r += 1
	zero_pos += 1
	if zero_pos == la:
		la += 1
		zero_pos = 1
	t = ['1'] * la
	t[zero_pos] = '0'
print(r)


(a, b) = map(int, input().split())
lis = list()
s = ''
for i in range(1, 69):
	s = s + '1'
	for j in range(1, len(s)):
		temp = s[:j] + '0' + s[j + 1:]
		lis.append(int(temp, 2))
c = 0
for x in lis:
	if x >= a and x <= b:
		c += 1
print(c)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
(l, r) = Ri()
ans = 0
for i in range(1, 64):
	tot = (1 << i) - 1
	for j in range(i - 1):
		temptot = tot & ~(1 << j)
		if l <= temptot <= r:
			ans += 1
print(ans)


var = input().split()
a = int(var[0])
b = int(var[1])
c = 0
i = 0
while (1 << i) / 2 <= b:
	j = 0
	while j <= i - 2:
		x = (1 << i) - 1 - (1 << j)
		if a <= x and x <= b:
			c += 1
		j += 1
	i += 1
print(c)


from collections import deque

def get_num(lst):
	return int(''.join(map(str, lst)), base=2)
(a, b) = list(map(int, input().split()))
n = 0
n_ovf = 1
tn = 1
cnt = 0
lst = deque([0])
template = [0]
for i in range(65):
	lst = deque(template[:])
	while get_num(lst) <= b:
		if get_num(lst) >= a:
			if lst[0] != 0:
				cnt += 1
		lst.appendleft(1)
	template.append(1)
print(cnt)


import sys, itertools
(a, b) = input().split(' ')
(a, b) = (int(a), int(b))

def exactlyOneZero():
	for totalLength in itertools.count(1):
		for leftOnes in range(1, totalLength):
			rightOnes = totalLength - leftOnes - 1
			s = '1' * leftOnes + '0' + '1' * rightOnes
			yield int(s, 2)

def count(a, b):
	ret = 0
	for i in exactlyOneZero():
		if i < a:
			continue
		if i > b:
			return ret
		ret += 1
print(count(a, b))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(a, b) = map(int, input().split())
ans = 0
for i in range(1, 65):
	for j in range(i - 1):
		x = (1 << i) - (1 << j) - 1
		if x >= a and x <= b:
			ans += 1
print(ans)


inp = input()
(n, m) = inp.split(' ')
n = int(n)
m = int(m)
count = 0
for i in range(2, 65):
	y = 2 ** i
	for j in range(i - 1):
		z = 2 ** j
		x = y - z - 1
		if x >= n and x <= m:
			count += 1
print(count)


(a, b) = map(int, input().split())
power = [1]
ans = 0
for i in range(60):
	power.append(power[-1] * 2)
for i in range(1, 60):
	for j in range(i - 1, -1, -1):
		if sum(power[i:j:-1]) + power[j] - 1 >= a and sum(power[i:j:-1]) + power[j] - 1 <= b:
			ans += 1
print(ans)


class var:
	List = []
	lim = 10 ** 18

def toint(n):
	number = 0
	for j in range(len(n)):
		number *= 2
		number += ord(n[j]) - 48
	return number

def f():
	for length in range(2, 100):
		for j in range(1, length):
			s = length * ['1']
			s[j] = '0'
			number = toint(s)
			if number <= var.lim:
				var.List.append(number)
f()
(l, r) = [int(j) for j in input().split()]
count = 0
for j in range(len(var.List)):
	if var.List[j] >= l and var.List[j] <= r:
		count += 1
print(count)


(l, r) = map(int, input().split())
a = []
for i in range(1, 64):
	x = (1 << i) - 1
	for j in range(i - 1):
		a.append(x ^ 1 << j)
ans = 0
for k in a:
	if k >= l and k <= r:
		ans += 1
print(ans)


(g, a) = ([], [int(i) for i in input().split()])
for i in range(2, 61):
	g += [int(2 ** i - 1) ^ 2 ** j for j in range(i - 1)]
print(sum([1 for i in sorted(g) if a[0] <= i <= a[1]]))


inputty = input()
[lower, upper] = inputty.split(' ')

def numBelow(upper):
	string = bin(upper)[2:]
	if string.count('0') > 1:
		total = string.find('0') - 1
	elif string.count('0') == 1:
		total = string.find('0')
	else:
		total = len(string) - 1
	total += sum(range(len(string) - 1))
	return total
output = numBelow(int(upper)) - numBelow(int(lower))
if bin(int(lower))[2:].count('0') == 1:
	output += 1
print(output)


(a, b) = map(int, input().split())
answer = 0
bits = 2
while bits <= 61:
	mask = 2 ** bits - 1
	for zero in range(bits - 1):
		x = mask - 2 ** zero
		if a <= x and x <= b:
			answer += 1
	bits += 1
print(answer)


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
(a, b) = IL()
years = []
for i in range(2, 61):
	x = 2 ** i - 1
	for j in range(i - 1):
		years.append(x - 2 ** j)
years.sort()
print(sum([a <= i <= b for i in years]))


(a, b) = map(int, input().split())
bin1 = bin(a)
bin1 = bin1[2:]
bin2 = bin(b)
bin2 = bin2[2:]
k1 = len(bin1) - 1
ans = k1 * (k1 - 1) // 2
flag = False
for i in range(len(bin1)):
	if bin1[i] == '0':
		flag = True
		break
if flag:
	ans += i - 1
else:
	ans += len(bin1) - 1
cnt = 0
for i in range(len(bin1)):
	if bin1[i] == '0':
		cnt += 1
if cnt == 1:
	ans += 1
k1 = len(bin2) - 1
ans1 = k1 * (k1 - 1) // 2
flag = False
for i in range(len(bin2)):
	if bin2[i] == '0':
		flag = True
		break
if flag:
	ans1 += i - 1
else:
	ans1 += len(bin2) - 1
cnt = 0
for i in range(len(bin2)):
	if bin2[i] == '0':
		cnt += 1
if cnt == 1:
	ans1 += 1
allans = ans1 - ans
cnt = 0
for i in range(len(bin1)):
	if bin1[i] == '0':
		cnt += 1
if cnt == 1:
	allans += 1
print(allans)


def fun(x):
	ans = 0
	for i in range(2, 63):
		mask = (1 << i) - 1
		for j in range(i - 1):
			y = mask ^ 1 << j
			if y <= x:
				ans += 1
	return ans
(a, b) = map(int, input().split())
print(fun(b) - fun(a - 1))


from math import log, floor
(a, b) = map(int, input().split())
z = a
p1 = 0
while z != 0:
	p1 += 1
	z >>= 1
z = b
p2 = 0
while z != 0:
	p2 += 1
	z >>= 1
count = 0
while p1 <= p2:
	p = 0
	exp = 2 ** p1 - 1
	while p < p1 - 1:
		if b >= exp - 2 ** p >= a:
			count += 1
		p += 1
	p1 += 1
print(count)