/*
とりあえずソースコード見る前に推し見ていってください。
                                                                                   ` ....J&wZTUUWc
                                                                             `...JZY"!~-._<~~~~_d'
                                                                       ` ..-Z"=~`..._~___::~~~_J\
       ........                                                    ` ..dY=````..~~__::::::::~_J\
  .KY"=<<<<<<<?77"YTXa-..                                      `  .JY=`````.-<~--::<<~~~~<:<_d^
   W,~~~_______<~-..`.. ?7TG+...`         ` ` `  `   ....   `  .v"~`````.-<~-JT1__........_-d'
    T,_~:::;:<z+-~~~~<-..``.`._?TSJ.. ..JVYT7TTTTTY"=<<<?7"TQJ=~`.``...?~~__(<~_......... .#`
     (h_~:<::((+v___._.~~?<.`````.`_?TG-__...___.__....` ..?~```.` .J!~~_..-~<7_......._ .P
      .W,_~~~_?71-.````` _~~?i..````````.``.```..```````._```.. .J>_~_`   ?<<__.......  (%
        ?p _..._._-z.,  ``` _~_?<- .`.````````````.``.````` _<1>_~~~~._ --(i-......._ .V!
         .W, ......(>~<~+-....~~~(t<!`.`.`.`.``.```.``.``` `   .<-~~((?1~?=_......_ .J=
           7e .........!_.C~-(>(?`  ` ````````````````````  `     ?(~_`` ``....  `.-Y
            .W, .......```` ~(<`   ` `   ` ``````````      `  `     ?-_.    ``` .J"
             `?h.     ` ` .~J! ` `     `  `   ` ` `   `  `   `  `  `  1__    ..J=
                7a,     .~_J`     ` ` `  ` ``   `  `  `   `    `  `  ` 1-_ (d=`
                  ?TGgJ<<_J`` ` `  ` - `  ```` ``` `  `(   `  `     ` .wWc<W_
                      .5g-$`   `     >  `````  ``` ` ` (-  `    `  `   _7HHXb.
                       .@H=`     ` `.l` ````  `  ```` `(<-`  _ `  `   `  j ?NHm,`
                    `.dHMF ` ` ` . `.$```` `    `` ````(~(.(<J- `  ` `   (  W7HHm,
                   `.@Ht,P` `   ._  (1_. `  ` `   `` .(T!_<-`?W+  `  ````(  d, (UHh.`
                `  .M#!  b``  ` ,Sv7TOo.  `  `   ` _~. <`` <. ({`  `` ` .<   h   .UH&`
                 `.MD`   O-`````vl  v.1__ ``` ``````.;.:``` 1 J1 ` ````.i! ` J;    ?Mh.
                 .WF     .n...``.?- > ->.-`````````..I+.`` ..e:(- . ```.V-  `.b      UN. `
                `(F      (C<~(<..l(1c` ?z1---....._jjA.JJadHYW@.> < ``.c(} `  d.      ?N.
               `.@`     .@  <((-_vM#HmQmq8?1&-~~~(J!`  WHMHMb `.>.> ._J~(!` ``(]       ,b   `
                ,>      d!`  ` v+(_`.HHMMb. `????````  XxdHMH~` >(iJO!_(> ```_ K        ,`
                .      .F` ` ``.c1s..HdMMH~````````````(BXVY=``.O>`.c_(>_````(-W
                      `J{;``` ``(+> `-77"= ```.````````````   ````..+>~~_````.}d
                       H(:```````.3 ..````````.````````````` `.` .>~~~({__ ``.Pd
                     ` Dd_```.....I ``````````_````````````````.v~~:~:(P_~_ ((bK
                       WM{ ...~~~~(o.``````````````` ..````` .?`(<:~(-+#_~~_1dH%
                       dvr-l..~~_s_w7+.``.<(-. ?!``~~..-<1.?!` J<+~:(iWH~::(kWF
                         X_w~~~(jM:Wc_O?42``` ?&+-;+<~``.(:` .4~(D~(Id!H~_(V!!
                         .hdm_~(d?hdNz-_(>``.._(_.(>_..``(:`` (1H%(uV! HV"!
                           7:?4uD.K~.._?z>`.._(JSjk-__`.`(C<<!_7H#"!
                                .dI:__-.I?&Jv=_+?>?l_?4v?> -< ...?h.
                    `        .JHz?1<:::J<(l ` J?1J<1_ `(:..?_...._Jb
                        `..v"!``(>(1+:(>~~(1.<(1<iJ><..C<_--1(:::+CJN.
                        J=````.` (a+g0Ws:::_:_::(<___<(~___(C~:<z<1>-Ta,`
                       `?e````.z@!     X<:::::::<+:::::?1+jdYTYAaZ!``` ?4a.`    `
                         (n.````Oe    .D_~~~:::::::::::::(W!     ?U, ````.To.      `
                          .4,````?Hka.f_....__~~::~:~:~~~_d;       (W,`` `` 7a.
                            ?N,  `-_4D..............~.~..._W,        ?NJ. ` ` ?4dYBh, `
                             JD?-   +_......................W.         _TS&,   `  ` TmJN`
                             .UR-...<z+-_-............-__-((dL             _Wn. `  .! (t   `
                            ` J8!_.2____<?<<<+(-(--(+<<1<<(_<jL             .N..`.J!  ?W&
                              d&J?` ~?<+-_(-~(-:(_: <.<(-(<7!_?o             ?B9Tn.` (4kdb
                        ` `.dY!   ` `./` ` _(????!!~!` ``(_``..?L                .4,m,iW.
                            .U,    `.!   `  !  `` `. `` ` < `...?r                 Wd?BY`
                              (N&.`.!` `   <  ```` _ ` ```(_`..(JV`   `  `
                             `(8-.?=<?1+-..+... ```(.......f<~?r          ` ` ......
                             .K`.?<-.   __(K<D__<?TC~~~~__```.-S.  ....-&ZY""777?77""9GJ,`   `
                            `J}````` _??<d= J{~~~~~(i.....-<<~`(Y77<~_``.```.```````.`.(XHa.    `
                        `   .K`````````.d^  X~~.~.~~_1. ````.`` I_....```.````.``.`````_dWqHm,
                           `(%``.`.```.Y    R~~~.~.~~~<-`````.``(-~~.....`.`````.``.``.(dWqkHh
                           .K_```.``.J^     S_~~~~~.~~~?:``.``.`.l~~~~...``.`.``````.``_zWkqkHb`
                        ` .d'`..```.Y`      q{~.~.~~.~.~(i ````.`(/.~~.....```.``.```.`.dWqqqqH[
                         .d!`~~_-.J^        .b_~.~~.~~~~~_1.  ..``?+~~~~....````````.` (WkHHM#H#
                         d!` __?(f`          ?n~~~.~~.~~~~~?i_.````?/~~.~..`.``.``.``._jkY"7=
                     `  .D``` `.%             ?h,~~~~.~..~~~~1, ``` j_~~....``.``.``.-V=`
                       `(}`   (\                Tm,~~~~~.~.~~~?- `` .>~~....``.``..JY`
               `   `   .g`   ('                   ?W&-~~~~~.~.~(>  ` 1_~~....`..JT^
                      d=<  .,Nx                      THaJ-_~~~~~(l   (o.(((JZ"^`
                `    .@   `?`.H.                        _"YBHmggk<!`` > W>
                      4eJ>:1.(t                                 W+.<(. .(D           `
                      ({?<!~db                                   W$<<jY4F`
                      ,h. _`.W`                                 (5..J=.d`
                    `   7TUY"`                                  4,...(Y!
                                                                  ~~`                         `

	でかいですね。
	更にかわいいときた。
	うん。好き。
*/
/*  include  */
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <setjmp.h>
#include <string.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>

/*  typedef  */
typedef long long ll;
typedef char string[100];
typedef int array[100];
/*  define  */

/*  define funcs  */
#define sort_du(array,end){ll size=end-array;qsort(array,size,sizeof(ll),intcmp);}
#define sort_cu(array,end){int size=end-array;qsort(array,size,sizeof(char),charcmp);}
#define sort_dd(array,end){ll size=end-array;qsort(array,size,sizeof(ll),intcmp2);}
#define sort_cd(array,end){int size=end-array;qsort(array,size,sizeof(char),charcmp2);}
#define sort_ldu(array,end){ll size=end-array;qsort(array,size,sizeof(ll),longlongcmp);}
#define sort_ldd(array,end){ll size=end-array;qsort(array,size,sizeof(ll),longlongcmp2);}
#define rand_range(min,max) (min)+(rand())%((max)-(min)+(1))
#define rep(i,j) for(int i=0;i<j;i++)
#define loop(i,j,z) for(int i=j;i<z;i++)
#define swap(a,b) ((a!=b)&&(a+=b,b=a-b,a-= b))
#define getarray_d(array,size){array=(int *)malloc(sizeof(int)*size);}
#define getarray_c(array,size){array=(char *)malloc(sizeof(char)*size);}
#define fill(array,end,val){int size=end-array;rep(i,size)array[i]=val;}

#define min(a,b) (a>b)?b:a
/*  otter  (Otter)  ｶﾜｳｿｯ！ */
#define intptr int *
#define random srand((unsigned)time(NULL))
#define ON 1
#define OFF 0
#define TREE_SIZE 1000

/*  prototype Declaration */
int intcmp(const void* a, const void* b);
int intcmp2(const void* a, const void* b);
int charcmp(const void* a, const void* b);
int charcmp2(const void* a, const void* b);
int longlongcmp(const void* a, const void* b);
int longlongcmp2(const void* a, const void* b);
bool is_sorted(const int* start, const int* end);
int count(const int* start, const int* end, int target);
void shuffle(int* start, int* end);
void tree_init(void);
int tree_root(int x);
void unite(int x, int y);
bool same(int x, int y);

/*  scan  */
#define sd(a) scanf("%d",&a)
#define sc(a) scanf("%c",&a), getchar()
#define sf(a) scanf("%f",&a)
#define ss(a) scanf("%s",a)
#define sld(a) scanf("%lld",&a)
/*  print  */
#define odn(a) printf("%d\n",a)
#define oldn(a) printf("%lld\n",a)
#define ocn(a) printf("%c\n",a)
#define ofn(a) printf("%f\n",a)
#define osn(a) printf("%s\n",a)
#define od(a) printf("%d ",a)
#define old(a) printf("%lld\n",a)
#define oc(a) printf("%c ",a)
#define of(a) printf("%f ",a)
#define os(a) printf("%s ",a)

/*  struct  */
typedef struct {
	int first;
	int second;
}pair;
/*  local val  */
int tree[TREE_SIZE];
int cnts=0;
/*  funcs （local）*/

 
/*  main program  */
int main(void)
{
	int a, b;
	sd(a),sd(b);
	int c = 0;
	for (int i = a; i <= b;i++) {
		int d = i % 10;
		int e = i / 10000 % 10;
		int f = i / 10 % 10;
		int g = i / 1000 % 10;
		if (d == e && f == g) c++;
	}
	od(c);
}

/*  funcs  (global)*/
void sort_first(pair* b, pair* e)
{
	int* dec;
	int s2 = e - b;
	int size = e - b;
	getarray_d(dec, size);
	rep(i, size) dec[i] = b[i].first;
	sort_du(dec, dec + s2);
	rep(i, size) b[i].first = dec[i];
}
void sort_second(pair* b, pair* e)
{
	int* dec;
	int s2 = e - b;
	int size = e - b;
	getarray_d(dec, size);
	rep(i, size) dec[i] = b[i].second;
	sort_du(dec, dec + s2);
	rep(i, size) b[i].second = dec[i];
}


int intcmp(const void* a, const void* b)
{
	return *(int*)a - *(int*)b;
}
int intcmp2(const void* a, const void* b)
{
	return *(int*)b - *(int*)a;
}
int longlongcmp(const void* a, const void* b)
{
	return *(long long*)a - *(long long*)b;
}
int longlongcmp2(const void* a, const void* b)
{
	return *(long long*)b - *(long long*)a;
}

int charcmp(const void* a, const void* b)
{
	return *(char*)a - *(char*)b;
}

int charcmp2(const void* a, const void* b)
{
	return *(char*)b - *(char*)a;
}

bool is_sorted(const int* start, const int* end)
{
	while (start != end) {
		if (*start > * (start + 1)) return false;
		start++;
	}
	return true;
}

int count(const int* start, const int* end, int target)
{
	int cnt = 0;
	int* array;
	int* p;

	array = (int*)malloc((end - start) * sizeof(int));

	if (array == NULL) {
		printf("Err0r");
		exit(-1);
	}

	memcpy(array, start, sizeof(int) * (end - start));
	sort_du(array, array + (end - start));
	p = (int*)bsearch(&target, array, end - start, sizeof(int), intcmp);

	if (p == NULL) {
		free(array);
		return 0;
	}
	while (*p == target)
		p++;
	p--;
	while (*p == target) {
		cnt++;
		p--;
	}

	free(array);

	return cnt;
}

void shuffle(int* start, int* end)
{
	random;

	int a, b;
	int size = end - start;

	rep(i, 500) {
		a = rand_range(0, size - 1);
		b = rand_range(0, size - 1);
		swap(start[a], start[b]);
	}
}
/*  tree  */

void tree_init(void)
{
	for (int i = 0; i < TREE_SIZE; i++) tree[i] = i;
}

int tree_root(int x)
{
	if (tree[x] == x) return x;
	return tree[x] = tree_root(tree[x]);
}

void unite(int x, int y)
{
	int rx = tree_root(x);
	int ry = tree_root(y);
	if (rx == ry) return;
	tree[rx] = ry;
}

bool same(int x, int y)
{
	int rx = tree_root(x);
	int ry = tree_root(y);
	return rx == ry;
}

ll pow_mod(ll n, ll k, ll m)
{
	if (k == 0) return 1;
	else if (k % 2) return pow_mod(n, k - 1, m) * n % m;
	else {
		int t = pow_mod(n, k / 2, m);
		return t * t % m;
	}
}


Measured memory_bytes: 128