import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  }
}

       import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  }
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  } main {
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String A = sc.next(); A sc.next() sc.next sc int start = Integer.parseInt(A); start Integer.parseInt(A) Integer.parseInt Integer A String B = sc.next(); B sc.next() sc.next sc int end = Integer.parseInt(B); end Integer.parseInt(B) Integer.parseInt Integer B int count = 0; count 0 for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    } int i = start; int i = start; i start i <= end i end i++ i++ i {
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    } {
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    } String judge = Integer.toString(i); judge Integer.toString(i) Integer.toString Integer i if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      } judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3) judge.charAt(0) == judge.charAt(4) judge.charAt(0) judge.charAt judge 0 judge.charAt(4) judge.charAt judge 4 judge.charAt(1) == judge.charAt(3) judge.charAt(1) judge.charAt judge 1 judge.charAt(3) judge.charAt judge 3 {
        count++;
      } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  }
} public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    
    String A = sc.next();
    int start = Integer.parseInt(A);
    String B = sc.next();
    int end = Integer.parseInt(B);
    int count = 0;
    
    for(int i = start; i <= end; i++){
      String judge = Integer.toString(i);
      if(judge.charAt(0) == judge.charAt(4) && judge.charAt(1) == judge.charAt(3)){
        count++;
      }
    }
    
    System.out.println(count);
  }
}

      