import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

} 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(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt(); b sc.nextInt() sc.nextInt sc long sum=0 sum 0 count=0 count 0 flag=0 flag 0 max=-999999 max -999999 999999 min=99999; min 99999 String buff; buff for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		} int i=a; int i=a; i a i<=b i b i++ i++ i {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		} {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		} buff=String.valueOf(i) buff String.valueOf(i) String.valueOf String i if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++; buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3) buff.charAt(0)==buff.charAt(4) buff.charAt(0) buff.charAt buff 0 buff.charAt(4) buff.charAt buff 4 buff.charAt(1)==buff.charAt(3) buff.charAt(1) buff.charAt buff 1 buff.charAt(3) buff.charAt buff 3 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int sample(int n) {
		return n;
	} sample {
		return n;
	} return n; n int n n public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		//int x=sc.nextInt();//,k=sc.nextInt();
		long sum=0,count=0,flag=0,max=-999999,min=99999;
		//long[] array=new long[n];
		//String s=sc.next();//,t=sc.next();
		String buff;
		//String[] array = new String[n];
		for(int i=a;i<=b;i++) {
			buff=String.valueOf(i);
			//System.out.println(buff);
			if(buff.charAt(0)==buff.charAt(4)&&buff.charAt(1)==buff.charAt(3))count++;
		}

		System.out.println(count);
	}
	public static int sample(int n) {
		return n;
	}

}
