include <iostream>
include <cstdio>
include <cstring>
include <cmath>
include <map>
include <string>
include <vector>
include <set>
include <queue>
include <deque>
include <stack>
include <algorithm>
include <unordered_map>
using namespace std;
bool valid(vector<int> digits)
{
sort(digits.begin(), digits.end());
int sum1 = 0, sum2 = 0;
for(unsigned int i=0; i < digits.size();i++)
{
if (sum2 <= sum1)
{
sum2 += i;
}
else
{
sum1 += i;
}
}
return sum1 == sum2;
}
int main()
{
int l, r;
while (cin >> l >> r)
{
int cnt = 0;
for (int i = l; i <= r; ++i)
{
vector<int> digits;
int num = i;
while (num)
{
int d = num % 10;
digits.push_back(d);
num /= 10;
}
if (valid(digits))
cnt++;
}
cout << cnt << endl;
}
system("PAUSE");
return 0;
}