import sys
def have_zeroes(num,val):
val_bin = bin(val)[2:]
counter = 0
for c in val_bin:
if c == '0':
counter += 1
return counter == num
def range_vals(num,val):
counter = 0
for i in range(1,val+1):
if have_zeroes(num,i):
counter += 1
return counter
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
arr = map(int, test.split())
print range_vals(arr[0],arr[1])
test_cases.close()
def have_zeroes(num,val):
val_bin = bin(val)[2:]
counter = 0
for c in val_bin:
if c == '0':
counter += 1
return counter == num
def range_vals(num,val):
counter = 0
for i in range(1,val+1):
if have_zeroes(num,i):
counter += 1
return counter
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
arr = map(int, test.split())
print range_vals(arr[0],arr[1])
test_cases.close()