import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    }
} Main public static void main(String[] args) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    } main {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    } int a a b b numOfPalindromic = 0; numOfPalindromic 0 int[] digit = new int[5]; digit new int[5] 5 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt() b sc.nextInt() sc.nextInt sc for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          } ; a<=b a b a++ a++ a {
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          } {
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          } for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・ int i=0; int i=0; i 0 i<digit.length i digit.length digit digit.length i++ i++ i digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・ digit[i] = (a/(int)Math.pow(10, i)) % 10 digit[i] digit i (a/(int)Math.pow(10, i)) % 10 (a/(int)Math.pow(10, i)) a (int)Math.pow(10, i) Math.pow Math 10 i 10 if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++; digit[0] == digit[4] &&  digit[1] == digit[3] digit[0] == digit[4] digit[0] digit 0 digit[4] digit 4 digit[1] == digit[3] digit[1] digit 1 digit[3] digit 3 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) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    }
} public class Main {
    public static void main(String[] args) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

      int a, b, numOfPalindromic = 0;
          int[] digit = new int[5];
          Scanner sc = new Scanner(System.in);

          a = sc.nextInt(); b = sc.nextInt();

          for(; a<=b; a++){
          	for(int i=0; i<digit.length; i++)
          		digit[i] = (a/(int)Math.pow(10, i)) % 10; // digit[0] = １の位, digit[1] = 10の位 ・・・

          	if (digit[0] == digit[4] &&  digit[1] == digit[3])
          			numOfPalindromic++;
          }

          System.out.println(numOfPalindromic);

    }
}