import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int count = 0; count 0 int[] c = new int[5]; c new int[5] 5 for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		} {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		} int j = i; j i int x = 0; x 0 while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			} j > 0 j 0 {
				c[x] = j % 10;
				j = j/10;
              	x++;
			} c[x] = j % 10 c[x] c x j % 10 j 10 j = j/10 j j/10 j 10 x++ x if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			} c[0] == c[4] && c[1] == c[3] c[0] == c[4] c[0] c 0 c[4] c 4 c[1] == c[3] c[1] c 1 c[3] c 3 {
				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 scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int count = 0;
		int[] c = new int[5];
		for (int i = a; i <= b; i++) {
			int j = i;
			int x = 0;
			while (j > 0) {
				c[x] = j % 10;
				j = j/10;
              	x++;
			}
			if (c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
	}
}
