
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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(count);
	} main {

		Scanner sc = new Scanner(System.in);

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

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(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 sc.close() sc.close sc for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		} {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		} if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			} i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10 i / 10000 == i % 10 i / 10000 i 10000 i % 10 i 10 i % 10000 / 1000 == i % 100 / 10 i % 10000 / 1000 i % 10000 i 10000 1000 i % 100 / 10 i % 100 i 100 10 {
				count++;
			} count++ count System.out.print(count) System.out.print 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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(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;
		sc.close();

		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10) {
				count++;
			}
		}
		System.out.print(count);
	}
}