// File Name : c.cpp
// Development : July 11 2012 21:23:20 IST
// Author : Xeronix
#include <iostream>
#include <cstdio>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <cstring>
#include <string.h>
#include <cstdlib>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <utility>
#include <cctype>
#include <list>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <map>
#include <set>
#include <float.h>
#define TR(c, i) for ( typeof((c).begin()) i = (c).begin(); i != (c).end(); i++ )
#define FOR(i, a, b) for ( i = a; i <= b; i++ )
#define ROF(i, a, b) for ( i = a; i >= b; i-- )
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort( ALL(v) )
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define ABS(a) ((a) < (0) ? (a)*(-1) : (a))
#define SWAP(a, b) {typeof(a) T; T=a; a=b; b=T;}
#define SET(x,a) memset(x,a,sizeof(x))
#define IN(x,a) x.find(a) != x.end()
#define SYNC ios_base::sync_with_stdio(false);
//#define LIM
#ifdef LIM
int S, D, Y, O;
char *inp, *out, *ipos, *opos, DIG[30];
#define FRMI inp=( char * )malloc( LIM*sizeof( char ) );fread_unlocked( inp,1,LIM,stdin );ipos=inp;
#define FWM out=( char * )malloc( LIM*sizeof( char ) );opos=out;
#define FWO fwrite_unlocked( out,opos-out,1,stdout );
#define GETI(n) n=0;while(*ipos<33){ipos++;}if(*ipos=='-'){S=-1;ipos++;}else{S=1;}while(*ipos>='0'){n=10*n+(*ipos-'0');ipos++;}n*=S;
#define PUTI(n) O=n;D=0;if(O<0){*opos++='-';O*=-1;}if(!O)*opos++='0';else{while(O){Y=O/10;DIG[D++]=O-Y*10+'0';O=Y;}\
while(D--)*opos++=DIG[D];}
#define PUTC(c) *opos++=c;
#endif
using namespace std;
long long int val( int n )
{
long long int v = 9;
int i;
FOR( i,0,n-2 ) {
v += 9LL*pow( 10,i );
}
return v;
}
long long int calc( long long int n )
{
stringstream ss;
ss << n;
string t = ss.str();
ss.str("");
int dig = t.length();
if( dig == 1 ) {
return n;
}
int i;
string s = "";
FOR( i,1,dig-2 ) {
s += t[i];
}
long long int fd = t[0] -'0';
long long int ld = n%10;
long long int a = dig >= 3 ? val(dig-1) : 9LL;
long long int b = (fd-1)*pow( 10,dig-2 );
long long int c = atoll( s.c_str() ) + (int)(ld>=fd);
return a+b+c;
}
int main()
{
long long int a, b;
cin >> a >> b;
cout << calc(b)-calc(a-1) << endl;
return 0;
}
Ly8gRmlsZSBOYW1lICAgOiBjLmNwcAovLyBEZXZlbG9wbWVudCA6IEp1bHkgMTEgMjAxMiAyMToyMzoyMCBJU1QKLy8gQXV0aG9yICAgICAgOiBYZXJvbml4CgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxjc3RkaW8+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxtYXRoLmg+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxjc3RkbGliPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDxudW1lcmljPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGNjdHlwZT4KI2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxsaW1pdHMuaD4KI2luY2x1ZGUgPHNpZ25hbC5oPgojaW5jbHVkZSA8dGltZS5oPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8ZmxvYXQuaD4KCiNkZWZpbmUgVFIoYywgaSkgZm9yICggdHlwZW9mKChjKS5iZWdpbigpKSBpID0gKGMpLmJlZ2luKCk7IGkgIT0gKGMpLmVuZCgpOyBpKysgKSAKI2RlZmluZSBGT1I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