#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a = 10;
long long int l,r;
scanf("%lld %lld",&l,&r);
long long int deter = 0;
if (l == r)
{
deter = 1;
if (r / 10 == 0)
{
goto end;
}
}
else if(r - l >= 10)
{
deter = 2;
cout << "2";
goto end;
}
else if(l % 10 <= 2&&r % 10 >= 3)
{
cout << "2";
deter = 2;
goto end;
}
else if( (l % 10 < 2&&r % 10 ==2)||(l % 10 == 3&& r % 10 >3) )
{
deter = 1;
if (r / 100 == 0)
{
goto end;
}
}
for (a = 10; a <= 1e18; a *= 10)
{
if (r / a==0)
{
goto end;
}
else if( (l/a) %10 <= 2&& (r/a) % 10 >= 3)
{
cout << "2";
deter = 2;
goto end;
}
}
end:
if (deter == 0)
{
cout << "1";
}
else if (deter == 1)
{
cout << deter;
}
return 0;
}