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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		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 sc.close() sc.close sc int count = 0; count 0 String str; str for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		} int i=A; int i=A; i A i<=B i B i++ i++ i {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		} {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		} str = ""+A str ""+A "" A if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			} str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3) str.charAt(0) == str.charAt(4) str.charAt(0) str.charAt str 0 str.charAt(4) str.charAt str 4 str.charAt(1) == str.charAt(3) str.charAt(1) str.charAt str 1 str.charAt(3) str.charAt str 3 {
				count++;
			} count++ count A++ A 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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		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();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		System.out.println(count);
	}
}