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 p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	}

} 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 p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	}

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

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	} 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 p = 0; p 0 for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		} int i = 0; int i = 0; i 0 i <= B-A i B-A B A i++ i++ i {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		} {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		} String str = String.valueOf(A+i); str String.valueOf(A+i) String.valueOf String A+i A i if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			} str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3) str.charAt(0) == str.charAt(4) str.charAt(0) str.charAt str 0 str.charAt(4) str.charAt str 4 str.charAt(1) == str.charAt(3) str.charAt(1) str.charAt str 1 str.charAt(3) str.charAt str 3 {
				p += 1;
			} p += 1 p 1 System.out.println(p) System.out.println System.out System System.out p 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 p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	}

} 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 p = 0;

		for(int i = 0; i <= B-A; i++) {
			String str = String.valueOf(A+i);
			if(str.charAt(0) == str.charAt(4)
					&& str.charAt(1) == str.charAt(3)) {
				p += 1;
			}
		}
		System.out.println(p);

	}

}