import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  } main {
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A =sc.nextInt(); A sc.nextInt() sc.nextInt sc int B =sc.nextInt(); B sc.nextInt() sc.nextInt sc int array[] = new int[5]; array new int[5] 5 int cnt = 0; cnt 0 for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   } int i=A; int i=A; i A i<=B i B i++ i++ i {
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   } {
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   } int n =i; n i int index =0; index 0 while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     } n>0 n 0 {
       array[index] = n%10;
       n=n/10;
       index++;
     } array[index] = n%10 array[index] array index n%10 n 10 n=n/10 n n/10 n 10 index++ index if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     } array[0]==array[4] && array[1] == array[3] array[0]==array[4] array[0] array 0 array[4] array 4 array[1] == array[3] array[1] array 1 array[3] array 3 {
     cnt++;
     } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A =sc.nextInt();
    int B =sc.nextInt();
    int array[] = new int[5];
    int cnt = 0;
   for(int i=A; i<=B; i++){
     int n =i;
     int index =0;
     while(n>0){
       array[index] = n%10;
       n=n/10;
       index++;
     }
     if(array[0]==array[4] && array[1] == array[3]){
     cnt++;
     }
   }
    System.out.println(cnt);
  }
}