import java.util.Scanner;

public class Main {

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	}

} import java.util.Scanner; Scanner java.util public class Main {

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	}

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int count = 0;

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner int B = scanner.nextInt(); B scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		} int i = A; int i = A; i A i < B+1 i B+1 B 1 i++ i++ i {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		} {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		} String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i String[] array = new String[5]; array new String[5] 5 for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			} int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
				array[j] = s.substring(j, j+1);
			} {
				array[j] = s.substring(j, j+1);
			} array[j] = s.substring(j, j+1) array[j] array j s.substring(j, j+1) s.substring s j j+1 j 1 if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			} array[0].equals(array[4]) && array[1].equals(array[3]) array[0].equals(array[4]) array[0].equals array[0] array 0 array[4] array 4 array[1].equals(array[3]) array[1].equals array[1] array 1 array[3] array 3 {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	}

} public class Main {

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	}

} Main
import java.util.Scanner;

public class Main {

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

		for (int i = A; i < B+1; i++) {
			String s = String.valueOf(i);
			String[] array = new String[5];
			for (int j = 0; j < 5; j++) {
				array[j] = s.substring(j, j+1);
			}

			if (array[0].equals(array[4]) && array[1].equals(array[3])) {
				count++;
			}
		}
		System.out.println(count);
	}

}