#include <bits/stdc++.h>
using namespace std;

int main()
{
	int a,b,c,d,jsq = 0;
	cin >> a >> b;
	int t;
	for(int i = a;i <= b;i++)
	{
		t = i;
		bool hg = 1;
		while(t > 0)
		{
			if(t == a)
			{
				c = t % 10;
				t /= 10;
			}	
			if(t / 10 == 0) 
			{
				c = t % 10;
				t /= 10;
			}
			else 
			{
				d = t % 10;
				t /= 10;
				if(c - 1 != d && c + 1 != d) hg = 0;
				else c = d;
			}
			
		}
		if(hg == 1) jsq++;
		else hg = 1;
	}
	cout << jsq << endl;
	return 0;
}