#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
queue<int>q;
int main() {
    int m,n; 
    while(cin>>m>>n)
    {
        if(n==0&&m==0)break;
        q.push(m);
        int ans=1;
        while(!q.empty())
        {
            int num = q.front();
            q.pop();
            if(num*2<=n)
            {
    //         cout<<num*2<<endl;
                q.push(num*2);
                ans++;
            }
            if(num*2+1<=n)
            {
    //         cout<<num*2+1<<endl;
                q.push(num*2+1);
                ans++;
            }
        }
        cout<<ans<<endl;
    }



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