import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	}
} import java.util.*; util.* java import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Integer.*; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.Long.parseLong; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import java.io.PrintWriter; PrintWriter java.io public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) int a = parseInt(sc.next()); a parseInt(sc.next()) parseInt sc.next() sc.next sc int b = parseInt(sc.next()); b parseInt(sc.next()) parseInt sc.next() sc.next sc sc.close() sc.close sc int cnt=0; cnt 0 char[] c = null; c null for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		} i = a; i = a i a i <= b i b i++ i++ i {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		} {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		} c = String.valueOf(i).toCharArray() c String.valueOf(i).toCharArray() String.valueOf(i).toCharArray String.valueOf(i) String.valueOf String i if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			} c[0]==c[4]&&c[1]==c[3] c[0]==c[4] c[0] c 0 c[4] c 4 c[1]==c[3] c[1] c 1 c[3] c 3 {
				cnt++;
			} cnt++ cnt out.println(cnt) out.println out cnt String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	}
} Main
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Long.parseLong;
//import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int cnt=0;
		char[] c = null;
		for (i = a; i <= b; i++) {
			c = String.valueOf(i).toCharArray();
			if(c[0]==c[4]&&c[1]==c[3]) {
				cnt++;
			}
		}
		out.println(cnt);
	}
}
