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 count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        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);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  } 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 count = 0; count 0 for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    } int i = a; int i = a; i a i<=b i b i++ i++ i {
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    } {
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    } String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      } s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4)) s.substring(0,1).equals(s.substring(4,5)) s.substring(0,1).equals s.substring(0,1) s.substring s 0 1 s.substring(4,5) s.substring s 4 5 s.substring(1,2).equals(s.substring(3,4)) s.substring(1,2).equals s.substring(1,2) s.substring s 1 2 s.substring(3,4) s.substring s 3 4 {
        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);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  }
} 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 count = 0;
    for(int i = a;i<=b;i++){
      String s = String.valueOf(i);
      if(s.substring(0,1).equals(s.substring(4,5)) && s.substring(1,2).equals(s.substring(3,4))){
        count++;
      }
    }
    System.out.println(count);
  }
}
