import 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();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        }
}
//鶏になれ import java.util.*; util.* java public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        }
} Main public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        } main {
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        } 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 sc.close() sc.close sc int yono = 0; yono 0 for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                } int i = a ; int i = a ; i a i <= b i b i++ i++ i {
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                } {
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                } int aa = i / 10000; aa i / 10000 i 10000 int bb = (i / 1000) % 10; bb (i / 1000) % 10 (i / 1000) i 1000 10 int dd = (i/ 10) % 10; dd (i/ 10) % 10 (i/ 10) i 10 10 int ee = i % 10; ee i % 10 i 10 if(aa == ee && bb == dd)yono++; aa == ee && bb == dd aa == ee aa ee bb == dd bb dd yono++ yono System.out.println(yono) System.out.println System.out System System.out yono 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();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        }
} public class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int a = sc.nextInt();
                int b = sc.nextInt();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        }
} Main
import 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();
                sc.close();
                int yono = 0;
                for(int i = a ; i <= b ; i++){
                        int aa = i / 10000;
                        int bb = (i / 1000) % 10;
                        int dd = (i/ 10) % 10;
                        int ee = i % 10;
                        if(aa == ee && bb == dd)yono++;
                }
                System.out.println(yono);
        }
}
//鶏になれ