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 sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		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 sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		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 sum = 0; sum 0 for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		} {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		} int c = 1; c 1 String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			} int j = 0; int j = 0; j 0 j < 5 / 2 j 5 / 2 5 2 j++ j++ j {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			} {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			} if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				} s.charAt(j) != s.charAt(5 - j - 1) s.charAt(j) s.charAt s j s.charAt(5 - j - 1) s.charAt s 5 - j - 1 5 - j - 1 5 j 1 {
					c = 0;
				} c = 0 c 0 if (c != 0) {
				sum++;
			} c != 0 c 0 {
				sum++;
			} sum++ sum System.out.println(sum) System.out.println System.out System System.out sum 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 sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		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 sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		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 sum = 0;
		for (int i = a; i <= b; i++) {
			int c = 1;
			String s = String.valueOf(i);
			for (int j = 0; j < 5 / 2; j++) {
				if (s.charAt(j) != s.charAt(5 - j - 1)) {
					c = 0;
				}
			}
			if (c != 0) {
				sum++;
			}
		}
		System.out.println(sum);
		sc.close();
	}

}
