#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#define x first
#define y second
#define endl '\n'
const int N = 200010;
using namespace std;
typedef long long ll;
ll f(ll x) {
ll t = 1;
while (t <= x)t <<= 1;
t >>= 1;
return t;
}
int main() {
ll l, r;
vector<pair<ll, ll>>ans;
cin >> l >> r;
if (l == 0) {//如果是左端点的话,则j=0
l = f(r);//计算小于等于r的最大次幂
ans.push_back({ 0,r });
}
for (ll i = l; i != r;) {
ll lb = i & -i;//计算lowbit
ll t = lb * (i / lb + 1);
if (t <= r)ans.push_back({ i,t });
else {
while (lb * (i / lb + 1) > r)lb /= 2;//如果超出范围,减小lb直至不超出范围为止
t = lb * (i / lb + 1);
ans.push_back({ i,t });
}
i = t;
}
cout << ans.size() << '\n';
for (auto t : ans) {
cout << t.x << " " << t.y << '\n';
}
return 0;
}