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 count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
} 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 count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	} 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 count = 0; count 0 for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		} int i = a; int i = a; i a i <= b i b i ++ i ++ i {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		} {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		} int tt = i /10000; tt i /10000 i 10000 int fi = i %10; fi i %10 i 10 int th = i /1000 %10; th i /1000 %10 i /1000 i 1000 10 int te = i /10 % 10; te i /10 % 10 i /10 i 10 10 if(tt == fi && th == te) {
				count++;
			} tt == fi && th == te tt == fi tt fi th == te th te {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc 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 count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
} 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 count = 0;
		for(int i = a; i <= b; i ++) {
			int tt = i /10000;
			int fi = i %10;
			int th = i /1000 %10;
			int te = i /10 % 10;
			if(tt == fi && th == te) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
}
