import java.util.Scanner;
public class Main {
	public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	}

} Main public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	} pal {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	} int[] A = new int[5]; A new int[5] 5 for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		} int i =0; int i =0; i 0 i < 5 i 5 i ++ i ++ i {
			A[i] = a%10;
			a /= 10;
		} {
			A[i] = a%10;
			a /= 10;
		} A[i] = a%10 A[i] A i a%10 a 10 a /= 10 a 10 if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		} A[0] == A[4] && A[1] == A[3] A[0] == A[4] A[0] A 0 A[4] A 4 A[1] == A[3] A[1] A 1 A[3] A 3 {
			return true;
		} return true; true {
			return false;
		} return false; false int a a public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	} main {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int A = stdIn.nextInt(); A stdIn.nextInt() stdIn.nextInt stdIn int B = stdIn.nextInt(); B stdIn.nextInt() stdIn.nextInt stdIn int count = 0; count 0 for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			if(pal(i)) {
				count++;
			}
		} {
			if(pal(i)) {
				count++;
			}
		} if(pal(i)) {
				count++;
			} pal(i) pal i {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	}

} public class Main {
	public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	}

} Main
import java.util.Scanner;
public class Main {
	public static boolean pal(int a) {
		int[] A = new int[5];
		for(int i =0; i < 5; i ++) {
			A[i] = a%10;
			a /= 10;
		}
		if(A[0] == A[4] && A[1] == A[3]) {
			return true;
		}
		else {
			return false;
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int A = stdIn.nextInt();
		int B = stdIn.nextInt();
		int count = 0;
		
		for(int i = A; i <= B; i++) {
			if(pal(i)) {
				count++;
			}
		}
		System.out.println(count);

	}

}