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

int main() {
  int a, b;
  cin >> a >> b;

  int ans = 0;
  for ( int n = a; n <= b; n++ ) {
    string num = to_string(n);
    if ( num[0] == num[4] && num[1] == num[3] ) { ans++; }
  }

  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A, B;
  cin >> A >> B;
  int x = 0;
  int C = A;
  
  for (int i = 0; i < B - A + 1; i++) {
    
    int y = C / 10000 + C / 1000 % 10 *10 + C / 100 % 10 * 100 + C / 10 % 10 * 1000 + C % 10 * 10000;
   
     if ( C == y ){
      x += 1;
    }
    
    
    C += 1;
  }
  
  cout << x << endl;
}