#include <iostream> #include "cstdio" int pointNum(int m, int n) { if (2 * m + 1 <= n) return pointNum(2 * m, n) + pointNum(2 * m + 1, n) + 1; else if (2 * m <= n) return pointNum(2 * m, n) + 1; else return 1; } int main() { int n, m; while (scanf("%d %d", &m, &n) != EOF) { if (m == 0 && n == 0) break; printf("%d\n", pointNum(m, n)); } return 0; }