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 ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	}} 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 ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	}} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	} 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 ans ans at at bt bt bb; bb ans = 0 ans 0 for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	} int i=a; int i=a; i a i<=b i b i++ i++ i {
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	} {
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	} at=i/1000 at i/1000 i 1000 bt=i-(i/100)*100 bt i-(i/100)*100 i (i/100)*100 (i/100) i 100 100 bb=bt bb bt bt=bt/10 bt bt/10 bt 10 bb=bb-bt*10 bb bb-bt*10 bb bt*10 bt 10 bt=bb*10+bt bt bb*10+bt bb*10 bb 10 bt if(at==bt){
			ans++;
			} at==bt at bt {
			ans++;
			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans 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 ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	}} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	}} 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 ans, at, bt,bb;
		ans = 0;
	for(int i=a;i<=b;i++){
		at=i/1000;
		bt=i-(i/100)*100;
		bb=bt;
		bt=bt/10;
		bb=bb-bt*10;
		bt=bb*10+bt;
		if(at==bt){
			ans++;
			}
	}
System.out.println(ans);
	}}