#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int count(int m, int n) {
  if (m > n) {
    return 0;
  } else if (m <= n) {
    int result;
    result = count(2 * m, n) + count(2 * m + 1, n) + 1;
    return result;
  }
  else {
  return 0;
  }
}
int  main() {
  int m, n;
  while (scanf("%d %d", &m, &n) != EOF) {
    if(m==0||n==0)
    {
      continue;
    }
    int result = count(m, n);
    printf("%d\n", result);
  }
  return 0;
}