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 ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    }
} 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 ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String [] args){
        Scanner sc =new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc =new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    } 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 ans =0; ans 0 for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        } Integer i =A; Integer i =A; i A i<=B i B i++ i++ i {
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        } {
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        } String[] s = i.toString().split(""); s i.toString().split("") i.toString().split i.toString() i.toString i "" if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            } s[0].equals(s[4]) && s[1].equals(s[3]) s[0].equals(s[4]) s[0].equals s[0] s 0 s[4] s 4 s[1].equals(s[3]) s[1].equals s[1] s 1 s[3] s 3 {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans 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 ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String [] args){
        Scanner sc =new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    }
} 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 ans =0;
        for (Integer i =A;i<=B;i++){
            String[] s = i.toString().split("");
            if (s[0].equals(s[4]) && s[1].equals(s[3])){
                ans++;
            }
        }
        System.out.println(ans);
    }
}