import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
} import java.util.Scanner; Scanner 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();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	} main {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	} 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 int a=0; a 0 for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		} int i=A; int i=A; i A i<=B i B i++ i++ i {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		} {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		} if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			} i/1000==i%10*10+i%100/10 i/1000 i 1000 i%10*10+i%100/10 i%10*10 i%10 i 10 10 i%100/10 i%100 i 100 10 {
				a=a+1;
			} a=a+1 a a+1 a 1 System.out.println(a) System.out.println System.out System System.out a 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();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int a=0;
		for(int i=A;i<=B;i++) {
			if(i/1000==i%10*10+i%100/10) {
				a=a+1;
			}
		}
		System.out.println(a);
	}
}