import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    }
    System.out.println(sum);
  }
} import java.util.*; util.* java class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    }
    System.out.println(sum);
  }
} Main public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    }
    System.out.println(sum);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    }
    System.out.println(sum);
  } 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 sum = 0; sum 0 for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    } int i=a ; int i=a ; i a i<=b i b i++ i++ i {
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    } {
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    } int a1 = i/1000; a1 i/1000 i 1000 int a11 = a1/10; a11 a1/10 a1 10 int a12 = a1%10; a12 a1%10 a1 10 int b1 = (i%1000)%100; b1 (i%1000)%100 (i%1000) i 1000 100 int b11 = b1/10; b11 b1/10 b1 10 int b12 = b1%10; b12 b1%10 b1 10 if( (a11==b12) && (a12==b11) ){
        sum++;
      } (a11==b12) && (a12==b11) (a11==b12) a11 b12 (a12==b11) a12 b11 {
        sum++;
      } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = 0;
    
    for(int i=a ; i<=b ; i++){
      int a1 = i/1000;
      int a11 = a1/10;
      int a12 = a1%10;
      
      int b1 = (i%1000)%100;
      int b11 = b1/10;
      int b12 = b1%10;
      
      if( (a11==b12) && (a12==b11) ){
        sum++;
      }
    }
    System.out.println(sum);
  }
}