#include<iostream>

using namespace std;

int CountNodes(int m,int n){
	if(m > n){   //递归出口
		return 0;   
	}
	return CountNodes(2 * m,n) + CountNodes(2 * m + 1,n) + 1;
}

//特殊二叉树
int main(){
	int m,n;
	while(scanf("%d%d",&m,&n) != EOF){
		printf("%d\n",CountNodes(m,n));
	}
	return 0;
}