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 cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

} 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 cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    } 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 cnt = 0; cnt 0 for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        } int i = 10000 ; int i = 10000 ; i 10000 i <= 99999 i 99999 i++ i++ i {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        } {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        } if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            } i >= A && i <= B i >= A i A i <= B i B {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            } int [] a = new int[5]; a new int[5] 5 int n = i; n i a[0] = n %10 a[0] a 0 n %10 n 10 n /= 10 n 10 a[1] = n %10 a[1] a 1 n %10 n 10 n /= 10 n 10 a[2] =n %10 a[2] a 2 n %10 n 10 n /= 10 n 10 a[3] = n %10 a[3] a 3 n %10 n 10 n /= 10 n 10 a[4] = n %10 a[4] a 4 n %10 n 10 if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                } a[0] == a[4] && a[1] == a[3] a[0] == a[4] a[0] a 0 a[4] a 4 a[1] == a[3] a[1] a 1 a[3] a 3 {
                     cnt++;
                } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt 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 cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

} 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 cnt = 0;
        for (int i = 10000 ; i <= 99999 ; i++) {
            if (i >= A && i <= B) {
                int [] a = new int[5];
                int n = i;
                a[0] = n %10;
                n /= 10;
                a[1] = n %10;
                n /= 10;
                a[2] =n %10;
                n /= 10;
                a[3] = n %10;
                n /= 10;
                a[4] = n %10;
                if (a[0] == a[4] && a[1] == a[3]) {
                     cnt++;
                }
            }
        }
        System.out.println(cnt);
    }

}