import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt() A sc.nextInt() sc.nextInt sc B = sc.nextInt(); B sc.nextInt() sc.nextInt sc long ans = 0; ans 0 for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        } int a = 1; int a = 1; a 1 a <= 9 a 9 a++ a++ a {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        } {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        } for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            } int b = 0; int b = 0; b 0 b <= 9 b 9 b++ b++ b {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            } {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            } for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                } int c = 0; int c = 0; c 0 c <= 9 c 9 c++ c++ c {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                } {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                } int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a; n 10000 * a + 1000 * b + 100 * c + 10 * b + a 10 * b 100 * c 10000 * a + 1000 * b + 100 * c + 10 * b + a 10000 * a 10000 a 1000 * b 1000 b 100 * c 100 c 10 * b 10 b a if (A <= n && n <= B) ans += 1; A <= n && n <= B A <= n A n n <= B n B ans += 1 ans 1 System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(), B = sc.nextInt();
        long ans = 0; //abcba
        for (int a = 1; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    int n = 10000 * a + 1000 * b + 100 * c + 10 * b + a;
                    if (A <= n && n <= B) ans += 1;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
}
