import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = Integer.parseInt(sc.next()); A Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int B = Integer.parseInt(sc.next()); B Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 0; ans 0 for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    } int i = A; int i = A; i A i <= B i B i++ i++ i {
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    } {
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    } int n = i; n i int j =0 ; j 0 j += (n%10) * 10000 j (n%10) * 10000 (n%10) n 10 10000 n /= 10 n 10 j += (n%10) * 1000 j (n%10) * 1000 (n%10) n 10 1000 n /= 10 n 10 j += (n%10) * 100 j (n%10) * 100 (n%10) n 10 100 n /= 10 n 10 j += (n%10) * 10 j (n%10) * 10 (n%10) n 10 10 n /= 10 n 10 j += n%10 j n%10 n 10 if(i == j){
        ans++;
      } i == j i j {
        ans++;
      } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int A = Integer.parseInt(sc.next());
    int B = Integer.parseInt(sc.next());
    
    int ans = 0;
    for(int i = A; i <= B; i++){
      int n = i;
      int j =0 ;
      j += (n%10) * 10000;
      n /= 10;
      j += (n%10) * 1000;
      n /= 10;
      j += (n%10) * 100;
      n /= 10;
      j += (n%10) * 10;
      n /= 10;
      j += n%10;
      
      if(i == j){
        ans++;
      }
    }
    System.out.println(ans);
  }
}