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();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	}
} 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();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	}
} Main public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	} main {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	} 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 num=0; num 0 for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		} int i=a; int i=a; i a i<=b i b i++ i++ i {
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		} {
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		} int man=i/10000; man i/10000 i 10000 int sen=(i-man*10000)/1000; sen (i-man*10000)/1000 (i-man*10000) i man*10000 man 10000 1000 int jyu=(i%100)/10; jyu (i%100)/10 (i%100) i 100 10 int iti=i%10; iti i%10 i 10 if(man==iti && sen==jyu) num++; man==iti && sen==jyu man==iti man iti sen==jyu sen jyu num++ num System.out.println(num) System.out.println System.out System System.out num 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 num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	}
} public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	}
} 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();
		int num=0;

		for(int i=a;i<=b;i++){
			int man=i/10000;
			int sen=(i-man*10000)/1000;
			int jyu=(i%100)/10;
			int iti=i%10;
			if(man==iti && sen==jyu) num++;
		}

		System.out.println(num);

	}
}