
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
} Main public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	} main {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	} new Main().solveB() new Main().solveB new Main() String[] args args private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} solveA {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} Scanner scanner = null; scanner null String[] wkArray = new String[3]; wkArray new String[3] 3 try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		} {
			if (scanner != null) {
				scanner.close();
			}
		} if (scanner != null) {
				scanner.close();
			} scanner != null scanner null {
				scanner.close();
			} scanner.close() scanner.close scanner {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} StringBuffer buff = new StringBuffer(); buff new StringBuffer() scanner = new Scanner(System.in) scanner new Scanner(System.in) for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
				wkArray[i] = scanner.next();
			} {
				wkArray[i] = scanner.next();
			} wkArray[i] = scanner.next() wkArray[i] wkArray i scanner.next() scanner.next scanner for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			} {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			} for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				} int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				} {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				} if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					} i == j i j {
						buff.append((wkArray[i].toCharArray())[j]);
					} buff.append((wkArray[i].toCharArray())[j]) buff.append buff (wkArray[i].toCharArray())[j] (wkArray[i].toCharArray()) wkArray[i].toCharArray wkArray[i] wkArray i j System.out.println(buff.toString()) System.out.println System.out System System.out buff.toString() buff.toString buff private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} solveB {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} Scanner scanner = null; scanner null int startNum = 0; startNum 0 int endNum = 0; endNum 0 try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		} {
			if (scanner != null) {
				scanner.close();
			}
		} if (scanner != null) {
				scanner.close();
			} scanner != null scanner null {
				scanner.close();
			} scanner.close() scanner.close scanner {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} scanner = new Scanner(System.in) scanner new Scanner(System.in) startNum = scanner.nextInt() startNum scanner.nextInt() scanner.nextInt scanner endNum = scanner.nextInt() endNum scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			} int i = startNum; int i = startNum; i startNum i <= endNum i endNum i++ i++ i {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			} {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			} char[] num = Integer.toString(i).toCharArray(); num Integer.toString(i).toCharArray() Integer.toString(i).toCharArray Integer.toString(i) Integer.toString Integer i if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				} num[0] == num[4] && num[1] == num[3] num[0] == num[4] num[0] num 0 num[4] num 4 num[1] == num[3] num[1] num 1 num[3] num 3 {
					count++;
				} count++ count System.out.println(count) System.out.println System.out System System.out count private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} solveC {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} Scanner scanner = null; scanner null int lineAB = 0; lineAB 0 int lineBC = 0; lineBC 0 int lineCA = 0; lineCA 0 try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		} {
			if (scanner != null) {
				scanner.close();
			}
		} if (scanner != null) {
				scanner.close();
			} scanner != null scanner null {
				scanner.close();
			} scanner.close() scanner.close scanner {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} scanner = new Scanner(System.in) scanner new Scanner(System.in) lineAB = scanner.nextInt() lineAB scanner.nextInt() scanner.nextInt scanner System.out.println("") System.out.println System.out System System.out "" private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} solveD {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	} Scanner scanner = null; scanner null int lineAB = 0; lineAB 0 int lineBC = 0; lineBC 0 int lineCA = 0; lineCA 0 try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		} {
			if (scanner != null) {
				scanner.close();
			}
		} if (scanner != null) {
				scanner.close();
			} scanner != null scanner null {
				scanner.close();
			} scanner.close() scanner.close scanner {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} scanner = new Scanner(System.in) scanner new Scanner(System.in) lineAB = scanner.nextInt() lineAB scanner.nextInt() scanner.nextInt scanner System.out.println("") System.out.println System.out System System.out "" public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
} public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		String[] wkArray = new String[3];

		try {
			StringBuffer buff = new StringBuffer();
			scanner = new Scanner(System.in);
			for (int i = 0; i < 3; i++) {
				wkArray[i] = scanner.next();
			}

			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 3; j++) {
					if (i == j) {
						buff.append((wkArray[i].toCharArray())[j]);
					}
				}
			}

			System.out.println(buff.toString());

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int startNum = 0;
		int endNum = 0;

		try {
			scanner = new Scanner(System.in);
			startNum = scanner.nextInt();
			endNum = scanner.nextInt();

			int count = 0;
			for (int i = startNum; i <= endNum; i++) {
				char[] num = Integer.toString(i).toCharArray();
				if (num[0] == num[4] && num[1] == num[3]) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}