import java.util.Scanner;
public class Main{
  public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    }
    System.out.println(count);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    }
    System.out.println(count);
  }
} Main public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          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++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          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++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    } int i  = a; int i  = a; i a i <= b i b i++ i++ i {
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    } {
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    } int i0 = (i/10000); i0 (i/10000) i 10000 int i1 = (i/1000)%10; i1 (i/1000)%10 (i/1000) i 1000 10 int i3 = (i/10)%10; i3 (i/10)%10 (i/10) i 10 10 int i4 = i%10; i4 i%10 i 10 if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      } i0 == i4 i0 i4 {
        if ( i1 == i3){
          count++;
        }
      } if ( i1 == i3){
          count++;
        } i1 == i3 i1 i3 {
          count++;
        } count++ count System.out.println(count) System.out.println System.out System System.out count String[] arsgs arsgs public class Main{
  public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    }
    System.out.println(count);
  }
} public class Main{
  public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    }
    System.out.println(count);
  }
} Main
import java.util.Scanner;
public class Main{
  public static void main(String[] arsgs){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int count = 0;
    for (int i  = a; i <= b; i++){
      int i0 = (i/10000);
      int i1 = (i/1000)%10;
      int i3 = (i/10)%10;
      int i4 = i%10;
      if( i0 == i4){
        if ( i1 == i3){
          count++;
        }
      }
    }
    System.out.println(count);
  }
}