import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = Integer.parseInt(str[0]); a Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int b = Integer.parseInt(str[1]); b Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int ans = 0; ans 0 for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		} int i = a; int i = a; i a i <= b i b i++ i++ i {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		} {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		} String s[] = String.valueOf(i).split(""); s String.valueOf(i).split("") String.valueOf(i).split String.valueOf(i) String.valueOf String i "" if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			} s[0].equals(s[4]) s[0].equals s[0] s 0 s[4] s 4 {
				if (s[1].equals(s[3])) {
					ans++;
				}
			} if (s[1].equals(s[3])) {
					ans++;
				} s[1].equals(s[3]) s[1].equals s[1] s 1 s[3] s 3 {
					ans++;
				} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		int ans = 0;
		for (int i = a; i <= b; i++) {
			String s[] = String.valueOf(i).split("");

			if (s[0].equals(s[4])) {
				if (s[1].equals(s[3])) {
					ans++;
				}
			}
		}

		System.out.println(ans);

	}
}