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