import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int tmp = 0; tmp 0 int count = 0; count 0 for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        } int i=a; int i=a; i a i<=b i b i++ i++ i {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        } {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        } tmp = i tmp i String num = new String(); num new String() while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            } tmp > 0 tmp 0 {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            } num += Integer.toString(tmp%10) num Integer.toString(tmp%10) Integer.toString Integer tmp%10 tmp 10 tmp /= 10 tmp 10 if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            } num.charAt(0) == num.charAt(4) num.charAt(0) num.charAt num 0 num.charAt(4) num.charAt num 4 {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            } if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                } num.charAt(1) == num.charAt(3) num.charAt(1) num.charAt num 1 num.charAt(3) num.charAt num 3 {
                    count += 1;
                } count += 1 count 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int tmp = 0;
        int count = 0;
        for(int i=a; i<=b; i++) {
            tmp = i;
            String num = new String();
            while(tmp > 0) {
                num += Integer.toString(tmp%10);
                tmp /= 10;
            }
            if(num.charAt(0) == num.charAt(4)) {
                if(num.charAt(1) == num.charAt(3)) {
                    count += 1;
                }
            }
        }
        System.out.println(count);
    }
}
