import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) long A = sc.nextLong(); A sc.nextLong() sc.nextLong sc long B = sc.nextLong(); B sc.nextLong() sc.nextLong sc sc.close() sc.close sc int count = 0; count 0 for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		} long l = A; long l = A; l A l <= B l B l++ l++ l {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		} {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		} String s = String.valueOf(l); s String.valueOf(l) String.valueOf String l String[] ss = s.split(""); ss s.split("") s.split s "" if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++; ss[0].equals(ss[4]) && ss[1].equals(ss[3]) ss[0].equals(ss[4]) ss[0].equals ss[0] ss 0 ss[4] ss 4 ss[1].equals(ss[3]) ss[1].equals ss[1] ss 1 ss[3] ss 3 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) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	}

} Main
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		sc.close();
		int count = 0;
		for(long l = A;l <= B;l++) {
			String s = String.valueOf(l);
			String[] ss = s.split("");
			if(ss[0].equals(ss[4]) && ss[1].equals(ss[3])) count++;
		}
		System.out.println(count);
	}

}
