#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn = 1e5 + 5, mod = 1e9 + 7, inf = 1e18;
ll dp[20][12][12][2];
ll bachtrach(string &lim, int ith, int last1, int last2, bool smaller)
{
if(ith == lim.size()) return 1;
if(dp[ith][last1+1][last2+1][smaller] != -1)
{
return dp[ith][last1+1][last2+1][smaller];
}
int curdig = lim[ith]-'0';
ll ans = 0;
if(smaller)
{
for(int i = 0; i <= 9; ++i)
{
if(i != last1 && i != last2) ans += bachtrach(lim, ith + 1, i, last1, 1);
}
}
else
{
for(int i = 0; i < curdig; ++i)
{
if(i != last1 && i != last2) ans += bachtrach(lim, ith + 1, i, last1, 1);
}
if(curdig != last1 && curdig != last2)
ans += bachtrach(lim, ith + 1, curdig, last1, 0);
}
return dp[ith][last1+1][last2+1][smaller] = ans;
}
ll slove(ll x)
{
string lim = to_string(x);
memset(dp, -1, sizeof(dp));
return bachtrach(lim, 0, -1, -1, 0);
}
int main()
{
// freopen(".INP", "r", stdin);
// freopen(".OUT", "w", stdout);
cin.tie(0)->sync_with_stdio(0);
ll a, b;
cin >> a >> b;
cout << slove(b) - slove(a - 1);
}