import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] tmp = br.readLine().split(" "); tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " String A = tmp[0]; A tmp[0] tmp 0 String B = tmp[1]; B tmp[1] tmp 1 int ans = 0; ans 0 for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		} int i = Integer.parseInt(A); int i = Integer.parseInt(A); i Integer.parseInt(A) Integer.parseInt Integer A i<=Integer.parseInt(B) i Integer.parseInt(B) Integer.parseInt Integer B i++ i++ i {
			if(kaibun(String.valueOf(i)))ans++;
		} {
			if(kaibun(String.valueOf(i)))ans++;
		} if(kaibun(String.valueOf(i)))ans++; kaibun(String.valueOf(i)) kaibun String.valueOf(i) String.valueOf String i ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	} kaibun {
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	} char a = n.charAt(0); a n.charAt(0) n.charAt n 0 char b = n.charAt(1); b n.charAt(1) n.charAt n 1 char aa = n.charAt(4); aa n.charAt(4) n.charAt n 4 char bb = n.charAt(3); bb n.charAt(3) n.charAt n 3 if(a == aa && b == bb)return true;
		else return false; a == aa && b == bb a == aa a aa b == bb b bb return true; true return false; false String n n public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmp = br.readLine().split(" ");
		String A = tmp[0];
		String B = tmp[1];

		int ans = 0;
		for(int i = Integer.parseInt(A);i<=Integer.parseInt(B);i++){
			if(kaibun(String.valueOf(i)))ans++;
		}
		System.out.println(ans);
	}

	static boolean kaibun(String n){
		char a = n.charAt(0);
		char b = n.charAt(1);
		char aa = n.charAt(4);
		char bb = n.charAt(3);

		if(a == aa && b == bb)return true;
		else return false;
	}

}
