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 result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	}
} 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 result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	} 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 result = 0; result 0 for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		} {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		} int num1 = i / 10000; num1 i / 10000 i 10000 int num2 = i / 1000 % 10; num2 i / 1000 % 10 i / 1000 i 1000 10 int num3 = i / 10 % 10; num3 i / 10 % 10 i / 10 i 10 10 int num4 = i % 10; num4 i % 10 i 10 if(num1 == num4 && num2 == num3) {
				result++;
			} num1 == num4 && num2 == num3 num1 == num4 num1 num4 num2 == num3 num2 num3 {
				result++;
			} result++ result System.out.println(result) System.out.println System.out System System.out result 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 result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	}
} 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 result = 0;
		for(int i = A; i <= B; i++) {
			int num1 = i / 10000;
			int num2 = i / 1000 % 10;
			int num3 = i / 10 % 10;
			int num4 = i % 10;
			if(num1 == num4 && num2 == num3) {
				result++;
			}
		}
		System.out.println(result);
	}
}
