import java.util.*;

class Main {
   public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     n     = scan.nextInt();
      int     v     = scan.nextInt();
      int     count = 0;

      int[] A = new int[5];
      for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          }
      System.out.println(count);
   }
} import java.util.*; util.* java class Main {
   public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     n     = scan.nextInt();
      int     v     = scan.nextInt();
      int     count = 0;

      int[] A = new int[5];
      for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          }
      System.out.println(count);
   }
} Main public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     n     = scan.nextInt();
      int     v     = scan.nextInt();
      int     count = 0;

      int[] A = new int[5];
      for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          }
      System.out.println(count);
   } main {
      Scanner scan  = new Scanner(System.in);
      int     n     = scan.nextInt();
      int     v     = scan.nextInt();
      int     count = 0;

      int[] A = new int[5];
      for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          }
      System.out.println(count);
   } Scanner scan  = new Scanner(System.in); scan new Scanner(System.in) int     n     = scan.nextInt(); n scan.nextInt() scan.nextInt scan int     v     = scan.nextInt(); v scan.nextInt() scan.nextInt scan int     count = 0; count 0 int[] A = new int[5]; A new int[5] 5 for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          } int i = n; int i = n; i n i <= v i v i++ i++ i {
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          } {
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          } A[0]  = i A[0] A 0 i A[1]  = A[0] % 10 A[1] A 1 A[0] % 10 A[0] A 0 10 A[0] /= 10 A[0] A 0 10 A[2]  = A[0] % 10 A[2] A 2 A[0] % 10 A[0] A 0 10 A[0] /= 10 A[0] A 0 10 A[3]  = A[0] % 10 A[3] A 3 A[0] % 10 A[0] A 0 10 A[0] /= 10 A[0] A 0 10 A[4]  = A[0] % 10 A[4] A 4 A[0] % 10 A[0] A 0 10 A[0] /= 10 A[0] A 0 10 if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             } A[0] == A[1] && A[2] == A[4] A[0] == A[1] A[0] A 0 A[1] A 1 A[2] == A[4] A[2] A 2 A[4] A 4 {
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;

class Main {
   public static void main(String[] args)
   {
      Scanner scan  = new Scanner(System.in);
      int     n     = scan.nextInt();
      int     v     = scan.nextInt();
      int     count = 0;

      int[] A = new int[5];
      for(int i = n; i <= v; i++){
          A[0]  = i;
          A[1]  = A[0] % 10;
          A[0] /= 10;
          A[2]  = A[0] % 10;
          A[0] /= 10;
          A[3]  = A[0] % 10;
          A[0] /= 10;
          A[4]  = A[0] % 10;
          A[0] /= 10;
          //for(int j = 0; j < 5; j++){
          //System.out.print(A[j]);
          //}
          //System.out.println();
          if(A[0] == A[1] && A[2] == A[4]){
             //System.out.println(A[0] + " " + A[4] + " " + A[2] + " " + A[1]);
             count++;
             }
          }
      System.out.println(count);
   }
}
