import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int min = sc.nextInt(); min sc.nextInt() sc.nextInt sc int max = sc.nextInt(); max sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        } int i = min; int i = min; i min i <= max i max i++ i++ i {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        } {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        } String str = String.valueOf(i); str String.valueOf(i) String.valueOf String i if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            } str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3) str.charAt(0) == str.charAt(4) str.charAt(0) str.charAt str 0 str.charAt(4) str.charAt str 4 str.charAt(1) == str.charAt(3) str.charAt(1) str.charAt str 1 str.charAt(3) str.charAt str 3 {
                count ++;
            } count ++ count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    }

} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int min = sc.nextInt();
        int max = sc.nextInt();

        int count = 0;
        for (int i = min; i <= max; i++) {
            String str = String.valueOf(i);
            if (str.charAt(0) == str.charAt(4)
                    && str.charAt(1) == str.charAt(3)) {
                count ++;
            }
        }

        System.out.println(count);
        sc.close();
    }

}
