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

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

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

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

	} main {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

	} 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 count = 0; count 0 for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		} int i = a; int i = a; i a i < b + 1 i b + 1 b 1 i++ i++ i {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		} {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		} if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			} i / 10000 == i % 10 i / 10000 i 10000 i % 10 i 10 {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			} if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				} i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10 i / 1000 - (i / 10000) * 10 i / 1000 i 1000 (i / 10000) * 10 (i / 10000) i 10000 10 (i % 100 - i % 10) / 10 (i % 100 - i % 10) i % 100 i 100 i % 10 i 10 10 {
					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 sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int count = 0;

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

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

		for (int i = a; i < b + 1; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 - (i / 10000) * 10 == (i % 100 - i % 10) / 10) {
					count++;
				}
			}

		}
		System.out.println(count);

	}
}