#include <fstream>

int main()
{
     std::ifstream in("bits.in");
     std::ofstream out("bits.out");
     int left, right;
     in >> left >> right;
     int ans = 0;
     for (int x = left; x <= right; x++)
     {
          for (int y = left; y <= right; y++)
          {
               int z = (x | y) ^ y;
               if (left <= z && z <= right)
                    ans++;
          }
     }
     out << ans << "\n";
}
