import java.util.Scanner;
public class Main{
		 
			public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			}
		 
		} import java.util.Scanner; Scanner java.util public class Main{
		 
			public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			}
		 
		} Main public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			} main {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc m= sc.nextInt(); m sc.nextInt() sc.nextInt sc int sum=0; sum 0 for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				} int i=n; int i=n; i n i<=m i m i++ i++ i {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				} {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				} int a1=i%10 a1 i%10 i 10 a2=i/10000; a2 i/10000 i 10000 int a3=(i%100-a1)/10 a3 (i%100-a1)/10 (i%100-a1) i%100 i 100 a1 10 a4=i/1000-a2*10; a4 i/1000-a2*10 i/1000 i 1000 a2*10 a2 10 if(a1==a2 && a3==a4) {
						sum++;
					} a1==a2 && a3==a4 a1==a2 a1 a2 a3==a4 a3 a4 {
						sum++;
					} sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{
		 
			public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			}
		 
		} public class Main{
		 
			public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			}
		 
		} Main
import java.util.Scanner;
public class Main{
		 
			public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
				int n = sc.nextInt(),m= sc.nextInt();
				int sum=0;
				for(int i=n; i<=m; i++) {
					int a1=i%10,a2=i/10000; 
					int a3=(i%100-a1)/10,a4=i/1000-a2*10;
					if(a1==a2 && a3==a4) {
						sum++;
					}
				}
				System.out.println(sum);
			}
		 
		}
