#include <iostream>
#include<string>
#include<map>
#include<vector>
#include<stack>
using namespace std;
int sum = 0;//全局变量
void getsum(int m, int n) {//递归
    if (m > n) {
        sum += 0;
        return;
    } else {
        sum++;//满足条件就子树结点加一
    }
    getsum(m * 2, n);//左子树
    getsum(m * 2 + 1, n);//右子树
    return;
}

int main() {
    int m, n;

    while (cin >> m >> n) {
        if (m == 0 && n == 0)
            break;

        getsum(m, n);
        cout << sum << endl;
        sum = 0;
    }

}


// 64 位输出请用 printf("%lld")