#include <bits/stdc++.h>   using namespace std;   long long l, r, f[100];   bool check(string s, int x, int y) {     if (s.size() % x != 0) return false;     for (int i = 0; i + x < s.size() and i + x < y + 1; i++)       if (s[i] != s[i + x]) return false;     return true;   }   long long p(int x) {     long long ans = 0;     for (int i = 1; i <= x; i++)       if (x % i == 0) {         f[i] = pow(2, i - 1);       }     for (int j = 1; j < x; j++) {       if (x % j != 0) continue;       ans += f[j];       for (int u = j * 2; u < x; u += j) f[u] -= f[j];     }     return ans;   }   long long solve(long long a) {     long long ans = 0;     string s =   ;     while (a) {       s += (a % (long long)2) +  0 ;       a /= (long long)2;     }     reverse(s.begin(), s.end());     bool no = 0;     for (int i = 1; i < s.size(); i++) {       if (check(s, i, 100000)) {         no = 1;       }     }     for (int i = 1; i < s.size(); i++) {       if (s[i] ==  0 ) continue;       s[i] =  0 ;       for (int j = 1; j <= i; j++) {         f[j] = check(s, j, i);       }       for (int j = i + 1; j < s.size(); j++) f[j] = pow(2, j - i - 1);       s[i] =  1 ;       for (int j = 1; j < s.size(); j++) {         if (s.size() % j != 0) continue;         ans += f[j];         for (int u = j * 2; u < s.size(); u += j) f[u] -= f[j];       }     }     for (int i = s.size() - 1; i >= 1; i--) ans += p(i);     ans += no;     return ans;   }   int main() {     scanf( %lld%lld , &l, &r);     printf( %lld , solve(r) - solve(l - 1));   }   