import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(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 = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		}
		System.out.println(count);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = Integer.parseInt(sc.next()); A Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int B = Integer.parseInt(sc.next()); B Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int count = 0; count 0 for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		} int i = A; int i = A; i A i <= B i B i++ i++ i {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		} {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		} String tmp = String.valueOf(i); tmp String.valueOf(i) String.valueOf String i if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			} tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3) tmp.charAt(0) == tmp.charAt(4) tmp.charAt(0) tmp.charAt tmp 0 tmp.charAt(4) tmp.charAt tmp 4 tmp.charAt(1) == tmp.charAt(3) tmp.charAt(1) tmp.charAt tmp 1 tmp.charAt(3) tmp.charAt tmp 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 = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		}
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(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 = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();
		
		int count = 0;
		for(int i = A; i <= B; i++) {
			String tmp = String.valueOf(i);
			if(tmp.charAt(0) == tmp.charAt(4) && tmp.charAt(1) == tmp.charAt(3)) {
				count++;
			}
		}
		System.out.println(count);
	}

}