import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt(); int B = sc.nextInt(); int numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    }
} import java.util.Scanner; Scanner 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 numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    }
} Main public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt(); int B = sc.nextInt(); int numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    } main {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt(); int B = sc.nextInt(); int numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    } 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 numOfPalindromic = 0; numOfPalindromic 0 for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++; ; A<=B A B A++ A++ A if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++; if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++; (A/10000 == A%10) && ((A/1000)%10 == (A/10)%10) (A/10000 == A%10) A/10000 A 10000 A%10 A 10 ((A/1000)%10 == (A/10)%10) (A/1000)%10 (A/1000) A 1000 10 (A/10)%10 (A/10) A 10 10 numOfPalindromic++ numOfPalindromic System.out.println(numOfPalindromic) System.out.println System.out System System.out numOfPalindromic 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 numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    }
} public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt(); int B = sc.nextInt(); int numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt(); int B = sc.nextInt(); int numOfPalindromic = 0;

      for(; A<=B; A++) if ((A/10000 == A%10) && ((A/1000)%10 == (A/10)%10)) numOfPalindromic++;
      System.out.println(numOfPalindromic);
    }
}