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

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

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

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		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 cnt = 0; cnt 0 for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		} {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		} String s = String.valueOf(i); s String.valueOf(i) String.valueOf String i char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s boolean x = f(c); x f(c) f c if(x) cnt++; x cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	} f {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	} boolean x = false; x false int l = a.length - 1; l a.length - 1 a.length a a.length 1 int cnt = 0; cnt 0 for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		} int i = 0; int i = 0; i 0 i < a.length / 2 i a.length / 2 a.length a a.length 2 i++ i++ i {
			if (a[i] == a[l - i])
				cnt++;
		} {
			if (a[i] == a[l - i])
				cnt++;
		} if (a[i] == a[l - i])
				cnt++; a[i] == a[l - i] a[i] a i a[l - i] a l - i l i cnt++ cnt if (cnt == a.length / 2)
			x = true; cnt == a.length / 2 cnt a.length / 2 a.length a a.length 2 x = true x true return x; x char[] a a public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

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

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

}