#include <iostream>
#include <bits/stdc++.h>
#include <queue>
using namespace std;

int main() {
    int m,n;
    while(cin>>m>>n){
        if(n==0){
            continue;
        }
        int num=0;
        queue<int> q;
        if(m>n/2){
            num = 1;
        }
        else{
            int i;
            q.push(m);
            while(!q.empty()){
                num++;
                i = q.front();
                q.pop();
                if(i*2<=n){
                    q.push(i*2);
                }
                if(i*2+1<=n){
                    q.push(i*2+1);
                }
            }
        }
        cout<<num<<endl;
    }
}