import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(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 scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		}
		System.out.println(count);
	} main {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		}
		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int i = 0; i 0 int count = 0; count 0 for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		} i = a; i = a i a i <= b i b i++ i++ i {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		} {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		} String str = i + ""; str i + "" i "" if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			} str.charAt(0) == str.charAt(4) str.charAt(0) str.charAt str 0 str.charAt(4) str.charAt str 4 {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			} if(str.charAt(1) == str.charAt(3)) {
					count++;
				} 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 scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(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 scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int i = 0;
		int count = 0;
		for(i = a; i <= b; i++) {
			String str = i + "";
			if(str.charAt(0) == str.charAt(4)) {
				if(str.charAt(1) == str.charAt(3)) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}