import 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 c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	} 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 c = 0; c 0 int x x y y z z w; w for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		} {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		} x = i / 10000 x i / 10000 i 10000 y = i % 10 y i % 10 i 10 z = i / 1000 - x * 10 z i / 1000 - x * 10 i / 1000 i 1000 x * 10 x 10 w = (i % 100 - y) / 10 w (i % 100 - y) / 10 (i % 100 - y) i % 100 i 100 y 10 if (x == y && z == w) {
				c++;
			} x == y && z == w x == y x y z == w z w {
				c++;
			} c++ c System.out.println(c) System.out.println System.out System System.out c sc.close() sc.close sc 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 c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	}
} Main
import 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 c = 0;
		int x, y, z, w;
		for (int i = A; i <= B; i++) {
			x = i / 10000;
			y = i % 10;
			z = i / 1000 - x * 10;
			w = (i % 100 - y) / 10;
			if (x == y && z == w) {
				c++;
			}
		}
		System.out.println(c);
		sc.close();
	}
}