import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	}
} import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	} main {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int A = Integer.parseInt(sc.next()); A Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int B = Integer.parseInt(sc.next()); B Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] array = new int[5]; array new int[5] 5 int result = 0; result 0 for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		} {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		} int n = i; n i int c = 0; c 0 while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			} n > 0 n 0 {
				array[c] = n % 10;
				n /= 10;
				c++;
			} array[c] = n % 10 array[c] array c n % 10 n 10 n /= 10 n 10 c++ c if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			} array[0] == array[4] && array[1] == array[3] array[0] == array[4] array[0] array 0 array[4] array 4 array[1] == array[3] array[1] array 1 array[3] array 3 {
				result++;
			} result++ result out.println(result) out.println out result out.flush() out.flush out String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	}
} Main
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int[] array = new int[5];
		int result = 0;
		
		for (int i = A; i <= B; i++) {
			int n = i;
			int c = 0;
			while (n > 0) {
				array[c] = n % 10;
				n /= 10;
				c++;
			}
			
			if (array[0] == array[4] && array[1] == array[3]) {
				result++;
			}
			
		}

		out.println(result);
		out.flush();
	}
}