import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	}
	static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java import java.math.BigDecimal; BigDecimal java.math public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	}
	static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
} Main public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	} main {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	} InputReader in = new InputReader(System.in); in new InputReader(System.in) PrintWriter w = new PrintWriter(System.out); w new PrintWriter(System.out) int ans = 0 ans 0 a = in.nextInt() a in.nextInt() in.nextInt in b = in.nextInt(); b in.nextInt() in.nextInt in for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++; int i = a; int i = a; i a i <= b i b i++ i++ i if (is_pal(i))
				ans++; if (is_pal(i))
				ans++; is_pal(i) is_pal i ans++ ans w.println(ans) w.println w ans w.close() w.close w String[] args args static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	} is_pal {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	} String x = Integer.toString(n); x Integer.toString(n) Integer.toString Integer n for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false; int i = 0; int i = 0; i 0 i < (x.length() / 2) i (x.length() / 2) x.length() x.length x 2 i++ i++ i if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false; if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false; x.charAt(i) != x.charAt(x.length() - 1 - i) x.charAt(i) x.charAt x i x.charAt(x.length() - 1 - i) x.charAt x x.length() - 1 - i x.length() - 1 - i x.length() x.length x 1 i return false; false return true; true int n n static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	} InputReader private InputStream stream; stream private byte[] buf = new byte[1024]; buf new byte[1024] 1024 private int curChar; curChar private int numChars; numChars public InputReader(InputStream stream) {
			this.stream = stream;
		} InputReader {
			this.stream = stream;
		} this.stream = stream this.stream this this.stream stream InputStream stream stream public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		} read {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		} if (numChars == -1)
				throw new UnknownError(); numChars == -1 numChars -1 1 throw new UnknownError(); new UnknownError() if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			} curChar >= numChars curChar numChars {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			} curChar = 0 curChar 0 try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				} catch (IOException e) {
					throw new UnknownError();
				} IOException e {
					throw new UnknownError();
				} throw new UnknownError(); new UnknownError() {
					numChars = stream.read(buf);
				} numChars = stream.read(buf) numChars stream.read(buf) stream.read stream buf if (numChars <= 0)
					return -1; numChars <= 0 numChars 0 return -1; -1 1 return buf[curChar++]; buf[curChar++] buf curChar++ curChar public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		} peek {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		} if (numChars == -1)
				return -1; numChars == -1 numChars -1 1 return -1; -1 1 if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			} curChar >= numChars curChar numChars {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			} curChar = 0 curChar 0 try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				} catch (IOException e) {
					return -1;
				} IOException e {
					return -1;
				} return -1; -1 1 {
					numChars = stream.read(buf);
				} numChars = stream.read(buf) numChars stream.read(buf) stream.read stream buf if (numChars <= 0)
					return -1; numChars <= 0 numChars 0 return -1; -1 1 return buf[curChar]; buf[curChar] buf curChar public void skip(int x) {
			while (x-- > 0)
				read();
		} skip {
			while (x-- > 0)
				read();
		} while (x-- > 0)
				read(); x-- > 0 x-- x 0 read() read int x x public int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String nextString() {
			return next();
		} nextString {
			return next();
		} return next(); next() next public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		} next {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		} int c = read(); c read() read while (isSpaceChar(c))
				c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuffer res = new StringBuffer(); res new StringBuffer() do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
				res.appendCodePoint(c);
				c = read();
			} res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		} nextLine {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		} StringBuffer buf = new StringBuffer(); buf new StringBuffer() int c = read(); c read() read while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			} c != '\n' && c != -1 c != '\n' c '\n' c != -1 c -1 1 {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			} if (c != '\r')
					buf.appendCodePoint(c); c != '\r' c '\r' buf.appendCodePoint(c) buf.appendCodePoint buf c c = read() c read() read return buf.toString(); buf.toString() buf.toString buf public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		} nextDouble {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		} int c = read(); c read() read while (isSpaceChar(c))
				c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
				sgn = -1;
				c = read();
			} c == '-' c '-' {
				sgn = -1;
				c = read();
			} sgn = -1 sgn -1 1 c = read() c read() read double res = 0; res 0 while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} !isSpaceChar(c) && c != '.' !isSpaceChar(c) isSpaceChar(c) isSpaceChar c c != '.' c '.' {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt()); c == 'e' || c == 'E' c == 'e' c 'e' c == 'E' c 'E' return res * Math.pow(10, nextInt()); res * Math.pow(10, nextInt()) res Math.pow(10, nextInt()) Math.pow Math 10 nextInt() nextInt if (c < '0' || c > '9')
					throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			} c == '.' c '.' {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			} c = read() c read() read double m = 1; m 1 while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				} !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				} if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt()); c == 'e' || c == 'E' c == 'e' c 'e' c == 'E' c 'E' return res * Math.pow(10, nextInt()); res * Math.pow(10, nextInt()) res Math.pow(10, nextInt()) Math.pow Math 10 nextInt() nextInt if (c < '0' || c > '9')
						throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() m /= 10 m 10 res += (c - '0') * m res (c - '0') * m (c - '0') c '0' m c = read() c read() read return res * sgn; res * sgn res sgn public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		} nextIntArray {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		} int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)
				a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		} nextLongArray {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		} long[] a = new long[n]; a new long[n] n for (int i = 0; i < n; i++)
				a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		} hasNext {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		} int value; value while (isSpaceChar(value = peek()) && value != -1)
				read(); isSpaceChar(value = peek()) && value != -1 isSpaceChar(value = peek()) isSpaceChar value = peek() value peek() peek value != -1 value -1 1 read() read return value != -1; value != -1 value -1 1 private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		} isSpaceChar {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		} return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	}
	static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
} public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	}
	static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
} Main
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class Main{
	public static void main (String[] args) throws java.lang.Exception {
		InputReader in = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int ans = 0, a = in.nextInt(), b = in.nextInt();
		for (int i = a; i <= b; i++)
			if (is_pal(i))
				ans++;
		w.println(ans);


		w.close();
	}
	static boolean is_pal(int n) {
		String x = Integer.toString(n);
		for (int i = 0; i < (x.length() / 2); i++)
			if (x.charAt(i) != x.charAt(x.length() - 1 - i))
				return false;
		return true;
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1)
				throw new UnknownError();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int peek() {
			if (numChars == -1)
				return -1;
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					return -1;
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar];
		}

		public void skip(int x) {
			while (x-- > 0)
				read();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public String nextString() {
			return next();
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		public String nextLine() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public double nextDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
		public boolean hasNext() {
			int value;
			while (isSpaceChar(value = peek()) && value != -1)
				read();
			return value != -1;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
}