import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int min = sc.nextInt();
		int max = sc.nextInt();
		int result = 0;
		for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		}
		System.out.println(result);
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int min = sc.nextInt();
		int max = sc.nextInt();
		int result = 0;
		for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int min = sc.nextInt();
		int max = sc.nextInt();
		int result = 0;
		for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		}
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		int min = sc.nextInt();
		int max = sc.nextInt();
		int result = 0;
		for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		}
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int min = sc.nextInt(); min sc.nextInt() sc.nextInt sc int max = sc.nextInt(); max sc.nextInt() sc.nextInt sc int result = 0; result 0 for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		} int i = min; int i = min; i min i <= max i max i++ i++ i {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		} {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		} String[] values = String.valueOf(i).split(""); values String.valueOf(i).split("") String.valueOf(i).split String.valueOf(i) String.valueOf String i "" if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			} values[0].equals(values[4]) && values[1].equals(values[3]) values[0].equals(values[4]) values[0].equals values[0] values 0 values[4] values 4 values[1].equals(values[3]) values[1].equals values[1] values 1 values[3] values 3 {
				result++;
			} result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int min = sc.nextInt();
		int max = sc.nextInt();
		int result = 0;
		for (int i = min; i <= max; i++) {
			String[] values = String.valueOf(i).split("");
			if (values[0].equals(values[4]) && values[1].equals(values[3])) {
				result++;
			}
		}
		System.out.println(result);
	}
}