import 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 cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} main {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} 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 cnt = 0; cnt 0 for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		} {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		} int n10 = i % 10; n10 i % 10 i 10 int n100 = i / 10 % 10; n100 i / 10 % 10 i / 10 i 10 10 int n1000 = i / 1000 % 10; n1000 i / 1000 % 10 i / 1000 i 1000 10 int n10000 = i / 10000 % 10; n10000 i / 10000 % 10 i / 10000 i 10000 10 if(n10 == n10000 && n100 == n1000) {
				cnt++;
			} n10 == n10000 && n100 == n1000 n10 == n10000 n10 n10000 n100 == n1000 n100 n1000 {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt 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 cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
} Main
import 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 cnt = 0;
		for(int i = a; i <= b; i++) {
			int n10 = i % 10;
			int n100 = i / 10 % 10;
			int n1000 = i / 1000 % 10;
			int n10000 = i / 10000 % 10;
			if(n10 == n10000 && n100 == n1000) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
}