import java.util.Scanner;

class Main{

	public static void main(String[] args) {




		Scanner scan = new Scanner(System.in);
		String A =scan.next();
		String B =scan.next();

		int numA = Integer.parseInt(A);
		int numB = Integer.parseInt(B);

		int ans = 0;

		for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		}
		System.out.println(ans);




	}


} import java.util.Scanner; Scanner java.util class Main{

	public static void main(String[] args) {




		Scanner scan = new Scanner(System.in);
		String A =scan.next();
		String B =scan.next();

		int numA = Integer.parseInt(A);
		int numB = Integer.parseInt(B);

		int ans = 0;

		for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		}
		System.out.println(ans);




	}


} Main public static void main(String[] args) {




		Scanner scan = new Scanner(System.in);
		String A =scan.next();
		String B =scan.next();

		int numA = Integer.parseInt(A);
		int numB = Integer.parseInt(B);

		int ans = 0;

		for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		}
		System.out.println(ans);




	} main {




		Scanner scan = new Scanner(System.in);
		String A =scan.next();
		String B =scan.next();

		int numA = Integer.parseInt(A);
		int numB = Integer.parseInt(B);

		int ans = 0;

		for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		}
		System.out.println(ans);




	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String A =scan.next(); A scan.next() scan.next scan String B =scan.next(); B scan.next() scan.next scan int numA = Integer.parseInt(A); numA Integer.parseInt(A) Integer.parseInt Integer A int numB = Integer.parseInt(B); numB Integer.parseInt(B) Integer.parseInt Integer B int ans = 0; ans 0 for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		} int i = numA; int i = numA; i numA i <= numB i numB i++ i++ i {
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		} {
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		} String x = String.valueOf(i); x String.valueOf(i) String.valueOf String i if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			} x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4) x.charAt(1) == x.charAt(3) x.charAt(1) x.charAt x 1 x.charAt(3) x.charAt x 3 x.charAt(0) == x.charAt(4) x.charAt(0) x.charAt x 0 x.charAt(4) x.charAt x 4 {
				ans++;

			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;

class Main{

	public static void main(String[] args) {




		Scanner scan = new Scanner(System.in);
		String A =scan.next();
		String B =scan.next();

		int numA = Integer.parseInt(A);
		int numB = Integer.parseInt(B);

		int ans = 0;

		for(int i = numA;i <= numB;i++){
			String x = String.valueOf(i);
			if(x.charAt(1) == x.charAt(3) && x.charAt(0) == x.charAt(4)  ){
				ans++;

			}
		}
		System.out.println(ans);




	}


}
