// VU TRUONG AN
#include <bits/stdc++.h>
#define F first
#define S second
#define maxn 200005
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define pi acos(-1)
#define bit(p,x) ((x>>p) & 1)
#define Task "CF"
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int > piii;

const int base = 200003;
const long long MM = 1ll * MOD * MOD;

int n;

bool Count(int x){
    string s;
    while(x > 0){
        int pos = x % 10;
        s += pos + '0';
        x /= 10;
    }
    n = s.length();
    s = " " + s;
    for(int i = 1;i <= n / 2;++i){
        if(s[i] != s[n - i + 1]) return 0;
    }
    return 1;
}

void Solve(){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a;i <= b;++i){
        ans += Count(i);
    }
    cout << ans;
}

void NumTime(){cerr << "Toi" << "\n";cerr << "Di" << "\n";cerr << "Chep" << "\n";cerr << "Code" << "\n";}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen(Task".inp", "r", stdin);
    freopen(Task".out", "w", stdout);
#endif
    int test = 1;
//    cin >> test;
    while(test--){
        NumTime();
        Solve();
    }
}

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

int main(){
  int A, B;
  cin >> A >> B;
  
  int answer = 0;
  for (int i=A; i<=B; i++){
    int a, b, c, d, e;
    
    a = i % 10;                           //1の位
    b = (i % 100 - i % 10) / 10;          //10の位
    c = (i % 1000 - i % 100) / 100;       //100の位
    d = (i % 10000 - i % 1000) / 1000;    //1,000の位
    e = (i % 100000 - i % 10000) / 10000; //10,000の位
     
    if (a == e && b == d)
      answer++;
  }
  
  cout << answer << endl;
}
