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 n[] = new int[5];
		int count = 0;
		int temp = 0;

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	}

} 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 n[] = new int[5];
		int count = 0;
		int temp = 0;

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	}

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

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int n[] = new int[5];
		int count = 0;
		int temp = 0;

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	} 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 n[] = new int[5]; n new int[5] 5 int count = 0; count 0 int temp = 0; temp 0 for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		} {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		} temp = i temp i for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			} int j = 0; int j = 0; j 0 j < 5 j 5 j++ j++ j {
				n[j] = temp % 10;
				temp = temp / 10;
			} {
				n[j] = temp % 10;
				temp = temp / 10;
			} n[j] = temp % 10 n[j] n j temp % 10 temp 10 temp = temp / 10 temp temp / 10 temp 10 if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			} n[0]==n[4] && n[1]==n[3] n[0]==n[4] n[0] n 0 n[4] n 4 n[1]==n[3] n[1] n 1 n[3] n 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 sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int n[] = new int[5];
		int count = 0;
		int temp = 0;

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	}

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

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	}

} 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 n[] = new int[5];
		int count = 0;
		int temp = 0;

		for(int i = A; i <= B; i++) {
			temp = i;
			for(int j = 0; j < 5; j++) {
				n[j] = temp % 10;
				temp = temp / 10;
			}

			if(n[0]==n[4] && n[1]==n[3]) {
				count++;
			}
		}

		System.out.println(count);
	}

}