import java.util.*;
import java.lang.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	} main {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int[] c=new int[6]; c new int[6] 6 int cou=0; cou 0 for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		} long i=a; long i=a; i a i<=b i b i++ i++ i {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		} {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		} long d=i; d i int e=10000; e 10000 int sum=0; sum 0 for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			} int k=0; int k=0; k 0 k<=4 k 4 k++ k++ k {
				sum+=d%10*e;
				e/=10;
				d/=10;
			} {
				sum+=d%10*e;
				e/=10;
				d/=10;
			} sum+=d%10*e sum d%10*e d%10 d 10 e e/=10 e 10 d/=10 d 10 if(i==sum)cou++; i==sum i sum cou++ cou System.out.println(cou) System.out.println System.out System System.out cou String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
} Main
import java.util.*;
import java.lang.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextInt();
		int b = sc.nextInt();
		int[] c=new int[6];
		int cou=0;
		for(long i=a;i<=b;i++) {
			long d=i;
		    int e=10000;
			int sum=0;
			for(int k=0;k<=4;k++) {
				sum+=d%10*e;
				e/=10;
				d/=10;
			}
			if(i==sum)cou++;
		}
		System.out.println(cou);
	}
}