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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    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 String c[] = new String [5]; c new String [5] 5 int count = 0; count 0 int n = b - a; n b - a b a for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    } {
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    } String s = String.valueOf(a); s String.valueOf(a) String.valueOf String a c = s.split("") c s.split("") s.split s "" if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      } c[0].equals(c[4]) && c[1].equals(c[3]) c[0].equals(c[4]) c[0].equals c[0] c 0 c[4] c 4 c[1].equals(c[3]) c[1].equals c[1] c 1 c[3] c 3 {
        count++;
      } count++ count a++ a 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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    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();
    String c[] = new String [5];
    int count = 0;
    int n = b - a; 
    for(int i = 0;i <= n;i++){
      String s = String.valueOf(a);
      c = s.split("");
      if(c[0].equals(c[4]) && c[1].equals(c[3])){
        count++;
      }
      a++;
    }
    System.out.println(count);
  }
}