import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 result = 0; result 0 for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		} ; A <= B A B A++ A++ A {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		} {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		} int digit1 = A / 10000; digit1 A / 10000 A 10000 int digit2 = A / 1000 % 10; digit2 A / 1000 % 10 A / 1000 A 1000 10 int digit4 = A / 10 % 10; digit4 A / 10 % 10 A / 10 A 10 10 int digit5 = A % 10; digit5 A % 10 A 10 if (digit1 == digit5 && digit2 == digit4) {
				result++;
			} digit1 == digit5 && digit2 == digit4 digit1 == digit5 digit1 digit5 digit2 == digit4 digit2 digit4 {
				result++;
			} result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		int result = 0;
		for (; A <= B; A++) {
			int digit1 = A / 10000;
			int digit2 = A / 1000 % 10;
			int digit4 = A / 10 % 10;
			int digit5 = A % 10;
			if (digit1 == digit5 && digit2 == digit4) {
				result++;
			}
		}
		System.out.println(result);
	}
}
