#include <iostream>
#include <string>
#include <queue>
using namespace std;

int DFS(int index, int end) {
    if (index > end) {
        return 0;
    } else {
        int left_child = index * 2;
        int right_child = index * 2 + 1;
        return 1 + DFS(left_child, end) + DFS(right_child, end);
    }
}

int main() {
    int M, N;
    while (scanf("%d %d", &M, &N) != EOF) {
        if (M == 0) {
            break;
        }
        cout << DFS(M, N);
    }
}