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 answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  }
  
  public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  }
  

  
} 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 answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  }
  
  public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  }
  

  
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  } main {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  } 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 answer =0; answer 0 for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    } int i=A; int i=A; i A i<=B i B i++ i++ i {
      if(isParin(i)){
        answer++;
      }
    } {
      if(isParin(i)){
        answer++;
      }
    } if(isParin(i)){
        answer++;
      } isParin(i) isParin i {
        answer++;
      } answer++ answer System.out.println(answer) System.out.println System.out System System.out answer String[] args args public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  } isParin {
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  } boolean res=false; res false if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    } n/10000==n%10&&(n/1000)%10==(n/10)%10 n/10000==n%10 n/10000 n 10000 n%10 n 10 (n/1000)%10==(n/10)%10 (n/1000)%10 (n/1000) n 1000 10 (n/10)%10 (n/10) n 10 10 {
      return true;
    } return true; true return res; res int n n public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  }
  
  public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  }
  

  
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  }
  
  public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  }
  

  
} 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 answer =0;
    for(int i=A;i<=B;i++){
      if(isParin(i)){
        answer++;
      }
    }
    System.out.println(answer);
  }
  
  public static boolean isParin(int n){
    boolean res=false;
    if(n/10000==n%10&&(n/1000)%10==(n/10)%10){
      return true;
    }
    return res;
  }
  

  
}