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 n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  }
} 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 n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  }
} Main public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  } main {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  } 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 n = 0; n 0 for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    } int i = a; int i = a; i a i <= b i b i++ i++ i {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    } {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    } if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++; i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 i / 10000 == i % 10 i / 10000 i 10000 i % 10 i 10 i % 10000 / 1000 == i % 100 / 10 i % 10000 / 1000 i % 10000 i 10000 1000 i % 100 / 10 i % 100 i 100 10 n++ n System.out.println(n) System.out.println System.out System System.out n 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 n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(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 n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  }
} 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 n = 0;
    
    for (int i = a; i <= b; i++) {
      if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 ) n++;
    }
    
    System.out.println(n);
  }
}
