import java.util.*;
public class Main {

    private void doit(){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            long a = sc.nextLong();
            long b = sc.nextLong();
            long suma = getC(a-1);
            long sumb = getC(b);
            //System.out.println("suma = " + suma + " sumb =  " +  sumb);
            System.out.println(sumb - suma);
        }
    }

    private long getC(long num) {
        if(num < 10){
            return (long)num + 1;
        }
        String numstr = "" + num;
        int len = numstr.length();
        long sum = 0;
        for(int i =0; i < len-1; i++){
            long nownum = (numstr.charAt(i) - '0');
            long nowvalue = nownum * pow(len - i - 2);
            sum += nowvalue;
        }
        sum += 10;
        if((numstr.charAt(0) - '0')  > (numstr.charAt(len-1) - '0') ){
            sum--;
        }
        return sum;
    }
    private long pow(int times){
        long sum = 1;
        for(int i = 0; i < times; i++){
            sum *= 10;
        }
        return sum;
    }

    public static void main(String[] args) {
        Main obj = new Main();
        obj.doit();
    }
}

import java.util.*;
import java.io.*;

public class Solution {
	FastScanner in;
	PrintWriter out;

	int len(long x) {
		if (x < 10) return 1;
		return 1 + len(x / 10);
	}

	long pow(int x) {
		if (x < 1) return 1;
		long ans = 1;
		for (int i = 0; i < x; i++)
			ans *= 10;
		return ans;
	}

	long f_digit(long x) {
		if (x < 10) return x;
		return f_digit(x / 10);
	}

	long without_first(long x) {
		if (x < 10) return 1;
		long s = 1;
		long tmp = x;
		while (tmp != 0) {
			tmp /= 10;
			if (tmp != 0) s *= 10;
		}
		s *= f_digit(x);
		return x - s;
	}

	long f(long r) {
		if (r == 0) return 0;
		long sum = 0;
		int z = len(r);
		for (int i = 1; i < z; i++)
			sum += 9 * pow(i - 2);
		long x = f_digit(r);
		sum += (x - 1) * pow(z - 2);
		if (x <= r % 10) {
			if (r < 100) sum++; else
				sum += without_first(r / 10) + 1;
		} else {
			if (r >= 100)
				sum += without_first(r / 10);
		}
		return sum;
	}

	boolean ok(long x) {
		if (f_digit(x) == (x % 10)) return true;
		return false;
	}

	public void solve() throws IOException {
		long l = in.nextLong();
		long r = in.nextLong();
		out.println(f(r) - f(l - 1));
	}

	public void run() {
		try {
			//in = new FastScanner(new File("input.txt"));
			//out = new PrintWriter(new File("output.txt"));

			in = new FastScanner(System.in);
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

	public static void main(String[] arg) {
		new Solution().run();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C implements Runnable {

	long[] dec;

	private void Solution() throws IOException {
		long l = nextLong(), r = nextLong();
		dec = new long[19];
		dec[0] = 1;
		for (int i = 1; i < 19; i++)
			dec[i] = dec[i - 1] * 10;
		print(ans(r) - ans(l - 1));
	}

	long ans(long num) {
		if (num < 10)
			return num;
		String s = Long.toString(num);
		int len = s.length();
		long res = 9;
		long first = Long.parseLong(s.substring(0, 1));
		long last = Long.parseLong(s.substring(len - 1, len));
		long mid = num > 100 ? Long.parseLong(s.substring(1, len - 1)) : 0;
		for (int i = 1; i <= 9; i++) {
			for (int j = 0; j <= len - 2; j++) {
				if (j < len - 2 || j == len - 2 && i < first)
					res += dec[j];
				else if (j == len - 2 && i == first) {
					res += mid;
					if (last >= i)
						res++;
				}

			}
		}
		return res;
	}

	public static void main(String[] args) {
		new C().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tokenizer;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			Solution();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(0);
		}
	}

	void print(Object... o) {
		for (int i = 0; i < o.length; i++) {
			if (i != 0)
				out.print(" ");
			out.print(o[i]);
		}
	}

	void println(Object... o) {
		for (int i = 0; i < o.length; i++) {
			if (i != 0)
				print(" ");
			print(o[i]);
		}
		print("\n");
	}

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

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(next());
	}

	String nextLine() throws IOException {
		return in.readLine();
	}

	String next() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(nextLine());
		return tokenizer.nextToken();
	}
}

import java.util.Scanner;

public class C {

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		p = new long[20];
		p[0] = 1;
		for (int i = 1; i < p.length; i++)
			p[i] = 10 * p[i - 1];
		System.out.println(count(b) - count(a - 1));
	}

	static long[] p;

	private static long count(long n)
	{
		if (n < 10)
			return n;
		String s = n + "";
		int len = s.length();
		long ret = 9;
		int first = s.charAt(0) - '0';
		for (int i = 1; i <= first; i++)
			if (i < first)
			{
				ret += p[len - 2];
			} else if (i == first && i <= s.charAt(len - 1) - '0')
			{
				if (len > 2)
					ret += Long.parseLong(s.substring(1, len - 1)) + 1;
				else
					ret++;
			} else if (len > 2)
			{
				ret += Long.parseLong(s.substring(1, len - 1));
			}
		for (int i = 2; i < len; i++)
			ret += 9 * p[i - 2];
		return ret;
	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner r = new Scanner(System.in);

        long L = r.nextLong();
        long R = r.nextLong();

        System.out.println(calc(R) - calc(L - 1));

    }

    private static long calc(long R) {
        if(R == 0)return 0;

        long ret = 0;
        for(int l = 1; l <= 18; l++){
            for(int d = 1; d <= 9; d++){
                if(l == len(R)){
                    char[] a = (R + "").toCharArray();

                    if(d < a[0] - '0'){
                        ret += pow(10, Math.max(0, l - 2));
                    }else if(d == a[0] - '0'){
                        for(int i = 1; i < l - 1; i++){
                            ret += (a[i] - '0') * pow(10, l - 1 - i - 1);
                        }
                        if(d <= a[l - 1] - '0')ret++;
                    }
                }else if(l < len(R)){
                    ret += pow(10, Math.max(0, l - 2));
                }
            }
        }
        return ret;
    }

    private static long pow(long x, int p) {
        long ret = 1;
        for(int i = 0; i < p; i++)
            ret *= x;
        return ret;
    }

    private static int len(long x) {
        int ret = 0;
        while(x > 0){
            ret++;
            x /= 10;
        }
        return ret;
    }
}

import java.util.List;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nguyen Trung Hieu - vuondenthanhcong11@yahoo.com
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    long[] tenPower = IntegerUtils.generatePowers(10, 19, Long.MAX_VALUE);

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long left = in.readLong();
        long right = in.readLong();
        long answer = count(right) - count(left - 1);
        out.printLine(answer);
    }

    private long count(long max) {
        long answer = 0;
        long ten = 1;
        int digitCount = 1;
        while (ten <= max && ten > 0) {
            for (int i = 1; i <= 9 && i * ten <= max; i++) {
                if ((i + 1) * ten - 1 <= max) {
                    if (ten == 1)
                        answer++;
                    else
                        answer += tenPower[digitCount - 2];
                } else if (max >= i * ten + i) {
                    answer += 1 + (max - i * ten - i) / 10;
                }
            }
            ten *= 10;
            digitCount++;
        }
        return answer;
    }
}

class IntegerUtils {

    public static long[] generatePowers(long base, int count, long mod) {
        long[] result = new long[count];
        if (count != 0)
            result[0] = 1 % mod;
        for (int i = 1; i < count; i++)
            result[i] = result[i - 1] * base % mod;
        return result;
    }

    }

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

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

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

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

import java.util.*;
import java.io.*;
public class LittleElephantAndInterval
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		long l = in.nextLong();
		long r = in.nextLong();

		long result = 0;
		for(int x = 0; x <= 17; x++)
		{
			for(int y = 1; y <= 9; y++)
			{
				long low = (long)Math.pow(10, x) * y;

				if(x > 0)
				{
					low += y;
				}

				long high = low;
				if(x > 1)
				{
					high += (((long)Math.pow(10, x - 1) - 1) * 10);
				}

				if(low >= l && high <= r)
				{
					result += (high / 10) - (low / 10) + 1;
				}
				else if(low <= l && high >= r)
				{
					result += (r / 10) - (l / 10) + 1;

					if(r % 10 < y)
					{
						result--;
					}
					if(l % 10 > y)
					{
						result--;
					}
				}
				else if(low <= l && high >= l)
				{
					result += (high / 10) - (l / 10) + 1;

					if(l % 10 > y)
					{
						result--;
					}
				}
				else if(low <= r && high >= r)
				{
					result += (r / 10) - (low / 10) + 1;

					if(r % 10 < y)
					{
						result--;
					}
				}
			}
		}

		System.out.println(result);
	}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class C
{
	String line;
	StringTokenizer inputParser;
	BufferedReader is;
	FileInputStream fstream;
	DataInputStream in;
	String FInput="";

	void openInput(String file)
	{

		if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
		else
		{
			try{

			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}

	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);

		//System.out.println("I read this number: " + val);
		return val;
	}

	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}

	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}

	}

	public void readFInput()
	{
		for(;;)
		{
			try
			{
				readNextLine();
				FInput+=line+" ";
			}
			catch(Exception e)
			{
				break;
			}
		}
		inputParser = new StringTokenizer(FInput, " ");
	}

	long NextLong()
    {
            String n = inputParser.nextToken();

            long val = Long.parseLong(n);

            return val;
    }

	public static void main(String [] argv)
	{
		String filePath=null;
		if(argv.length>0)filePath=argv[0];
		new C(filePath);
	}

	public C(String inputFile)
	{
		openInput(inputFile);

		readNextLine();
		long a=NextLong()-1;
		long b=NextLong();

		long ret=getNum(""+b)-getNum(""+a);

		System.out.println(ret);

        closeInput();
	}

	private long getNum(String s) {
		int L=s.length();
		if(L<2)
		{
			return Long.parseLong(s);
		}
		int f=s.charAt(0)-'0';
		Long a=Long.parseLong(s);
		while(a%10!=f){a--;s=""+a;f=s.charAt(0)-'0';}
		if(a<10)return a;
		L=s.length();
		s=s.substring(1,s.length()-1);
		long num=0;
		if(s.length()>0)num=Long.parseLong(s);
		long ret=0;
		ret+=(f-1)*getMul(s);
		ret+=num+1;
		s="";
		for(int i=0; i<L-1; i++)s+="9";
		ret+=getNum(s);
		return ret;
	}

	private long getMul(String s)
	{
		long ret=s.length();
		ret=(long)Math.pow(10, ret);
		return ret;
	}

}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.StringTokenizer;

public class CodeD
{
	static class Scanner
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		public String nextLine()
		{
			try
			{
				return br.readLine();
			}
			catch(Exception e)
			{
				throw(new RuntimeException());
			}
		}

		public String next()
		{
			while(!st.hasMoreTokens())
			{
				String l = nextLine();
				if(l == null)
					return null;
				st = new StringTokenizer(l);
			}
			return st.nextToken();
		}

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

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

		public double nextDouble()
		{
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n)
		{
			int[] res = new int[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextInt();
			return res;
		}

		public long[] nextLongArray(int n)
		{
			long[] res = new long[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextLong();
			return res;
		}

		public double[] nextDoubleArray(int n)
		{
			double[] res = new double[n];
			for(int i = 0; i < res.length; i++)
				res[i] = nextDouble();
			return res;
		}
		public void sortIntArray(int[] array)
		{
			Integer[] vals = new Integer[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortLongArray(long[] array)
		{
			Long[] vals = new Long[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public void sortDoubleArray(double[] array)
		{
			Double[] vals = new Double[array.length];
			for(int i = 0; i < array.length; i++)
				vals[i] = array[i];
			Arrays.sort(vals);
			for(int i = 0; i < array.length; i++)
				array[i] = vals[i];
		}

		public String[] nextStringArray(int n)
		{
			String[] vals = new String[n];
			for(int i = 0; i < n; i++)
				vals[i] = next();
			return vals;
		}

		Integer nextInteger()
		{
			String s = next();
			if(s == null)
				return null;
			return Integer.parseInt(s);
		}

		int[][] nextIntMatrix(int n, int m)
		{
			int[][] ans = new int[n][];
			for(int i = 0; i < n; i++)
				ans[i] = nextIntArray(m);
			return ans;
		}

		static <T> T fill(T arreglo, int val)
		{
			if(arreglo instanceof Object[])
			{
				Object[] a = (Object[]) arreglo;
				for(Object x : a)
					fill(x, val);
			}
			else if(arreglo instanceof int[])
				Arrays.fill((int[]) arreglo, val);
			else if(arreglo instanceof double[])
				Arrays.fill((double[]) arreglo, val);
			else if(arreglo instanceof long[])
				Arrays.fill((long[]) arreglo, val);
			return arreglo;
		}

		<T> T[] nextObjectArray(Class <T> clazz, int size)
		{
			@SuppressWarnings("unchecked")
			T[] result = (T[]) java.lang.reflect.Array.newInstance(clazz, size);
			for(int c = 0; c < 3; c++)
			{
				Constructor <T> constructor;
				try
				{
					if(c == 0)
						constructor = clazz.getDeclaredConstructor(Scanner.class, Integer.TYPE);
					else if(c == 1)
						constructor = clazz.getDeclaredConstructor(Scanner.class);
					else
						constructor = clazz.getDeclaredConstructor();
				}
				catch(Exception e)
				{
					continue;
				}
				try
				{
					for(int i = 0; i < result.length; i++)
					{
						if(c == 0)
							result[i] = constructor.newInstance(this, i);
						else if(c == 1)
							result[i] = constructor.newInstance(this);
						else
							result[i] = constructor.newInstance();
					}
				}
				catch(Exception e)
				{
					throw new RuntimeException(e);
				}
				return result;
			}
			throw new RuntimeException("Constructor not found");
		}
	}

	static char[] numero;

	static long[][][] dp;

	static long dp(int digito, int primero, boolean tope)
	{
		if(dp[digito][primero][tope ? 1 : 0] != -1) return dp[digito][primero][tope ? 1 : 0];
		int limite = tope ? numero[digito] - '0' : 9;
		long cuenta = 0;
		for(int i = 0; i <= limite; i++)
		{
			if(digito == 0)
			{
				if(primero == 0 || primero == i)
					cuenta++;
			}
			else
				cuenta += dp(digito - 1, primero == 0 ? i : primero, tope && i == limite);
		}
		return dp[digito][primero][tope ? 1 : 0] = cuenta;
	}

	static long dpAux(long n)
	{
		numero = new StringBuilder(String.valueOf(n)).reverse().toString().toCharArray();
		dp = Scanner.fill(new long[numero.length + 2][10][2], -1);
		return dp(numero.length - 1, 0, true);
	}

	public static void main(String[] args)
	{
		Scanner sc = new Scanner();
		long[] v = sc.nextLongArray(2);
		System.out.println(dpAux(v[1]) - dpAux(v[0] - 1));
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.MathContext;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		long left = nl();
		long right= nl();

		return go(right)-go(left-1);
	}

	private long go(long k) {
		if(k<10L)
			return k;

		String s = Long.toString(k);
		long ret =0;
		int n = s.length();
		long exp=1;
		for(int i =1;i<=n-1;i++)
			if(i==1){
				ret+=9L;
			}else{
				ret+= 9L * exp;
				exp*=10L;
			}
		long first = s.charAt(0)-'0';
		ret += (first-1L) * pow(10L, n-2);
		k-=first*pow(10L,n-1);
		k/=10L;
		ret+=k;
		if(s.charAt(0)<=s.charAt(n-1))
			ret++;
		return ret;
	}

	private long pow(long base, int exp) {
		long ret =1;
		for(int i =0;i<exp;i++)
			ret*=base;
		return ret;
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}

import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.*;

public class C {

    static void solve() throws Exception {
        long l = nextLong();
        long r = nextLong();
        long res = f(r) - f(l - 1);
        System.out.print(res);
    }

    static long f(long x){
        if(x < 10){
            return x;
        }
        String s = Long.toString(x);
        return 9 + (x/10 - 1) + (s.charAt(0) <= s.charAt(s.length() - 1)?1:0);
    }

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    static void debug(Object... a) {
        System.err.println(deepToString(a));
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static void main(String[] args) {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            solve();
            br.close();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author patel
 */
import java.io.*;
import java.util.*;
public class CContest129 {
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException {
        in=new FastScanner(System.in);
        long l=Long.parseLong(in.next());
        long r=Long.parseLong(in.next());
        long count=0;
        count=f(r)-f(l-1);
        System.out.println(count);
    }
    public long f(long x){
        if(x<=9)return x;
        String build=Long.toString(x);
        return 9+(x/10-1)+(build.charAt(0)<=build.charAt(build.length()-1)?1:0);
    }

    public void run() {
        try {
          //  in = new FastScanner(new File(".in"));
         //   out = new PrintWriter(new File(".out"));

            solve();

         //   out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        FastScanner(InputStream in) {

                br = new BufferedReader(new InputStreamReader(in));

        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

    public static void main(String[] arg) {
        new CContest129().run();
    }
}

import java.util.Scanner;

public class C_129C {
	static long pow[];
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		long l = sc.nextLong()-1;
		long r = sc.nextLong();
		pow = new long[19];
		pow[1] = 9;
		for (int i = 2; i <=18; i++) {
			pow[i] =  9 * (long) Math.pow(10,i-2);
		}
//		System.out.println("f(r) = "+f(r+"")+" l = "+f(l+""));
		System.out.println(f(r+"")-f(l+""));
	}
	static long f(String s){
		long res = 0;
		if(s.length()<=1){
			return Integer.parseInt(s);
		}
		for (int i =1; i <=s.length()-1; i++) {
			res+= pow[i];
		}
		int first = s.charAt(0);
		int last = s.charAt(s.length()-1);
		res+=(first - 49) * (long) Math.pow(10, s.length()-2);
		long t = 0;
		if(1<s.length()-1){
			t = Long.parseLong(s.substring(1,s.length()-1));
		}
		if(first <= last) t++;
		if(t>0) res+=t;
		return res;
	}
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        String left = jin.next();
        String right = jin.next();

        long count = 0;
        for(int i = left.length() + 1; i <= right.length(); i++) {
            if(i > 2) {
                count += (long)(9 * Math.pow(10, i - 2));
            } else {
                count += 9;
            }
        }

        long cl = compute(left);
        long cr = compute(right);

        if(right.charAt(0) == right.charAt(right.length() - 1))
            cr--;

        jout.println(count + cl - cr);
    }

    private long compute(String left) {
        int val = (left.charAt(0) - '0') + 1;
        int len = Math.max(0, left.length()-2);

        long tot = (long) Math.pow(10, len);
        long result = (9 - val + 1) * tot;
        if(left.charAt(0) == left.charAt(left.length() - 1)) {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
            } else {
                result++;
            }
        } else {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
                if (left.charAt(left.length() - 1) > left.charAt(0))
                    result--;
            } else if(left.length() > 1) {
                if (left.charAt(left.length() - 1) < left.charAt(0))
                    result++;
            } else {
                result++;
            }
        }
        return result;
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class P204A
{
	static long[][][] dp;
	static char[] num;
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		System.out.println(get(b) - get(a-1));
	}

	private static long get(long n)
	{
		if (n == 0)
			return 0;
		num = (""+n).toCharArray();
		for (int i = 0; i < num.length; i++)
			num[i] -= '0';
		dp = new long[num.length][10][2];
		for (int i = 0; i < dp.length; i++)
			for (int j = 0; j < dp[0].length; j++)
				Arrays.fill(dp[i][j], -1);

		return under(0, 0, 1);
	}

	private static long under(int ind, int first, int bound)
	{
		if (dp[ind][first][bound] >= 0)
			return dp[ind][first][bound];
		long ans = 0;
		int b = bound == 1 ? num[ind] : 9;
		for (int i = 0; i <= b; i++)
		{
			if (ind == num.length-1)
			{
				if (i != 0)
				{
					if (i == first || first == 0)
						ans++;
				}
			}
			else
			{
				ans += under(ind+1, first == 0 ? i : first, bound == 1 && i == b ? 1 : 0);
			}
		}

		return dp[ind][first][bound] = ans;
	}
}

import java.util.Scanner;

public class A {

    public static int MOD = 1_000_000_007;
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        long l = scanner.nextLong();
        long r = scanner.nextLong();
        long L = Interval(l - 1);
        long R = Interval(r);
//        System.out.println(Interval(r) - Interval(l - 1));
        System.out.println(R - L);
/*     int res = 0;
     for(int i = 1; i <= 1024; ++i){
         if (i < 10) ++res;
         else {
             int a = i % 10;
             int x = i;
             while(x >= 10){
                 x /= 10;
             }
             if (a == x) ++res;
         }
     }

        System.out.println(res);*/
    }

    public static long Interval(long n){
        if (n < 10) return n;
        long ans = 9;
        int d = digits(n);
        for (int i = 2; i < d; ++i){
            ans += 9 * (long)Math.pow(10, i - 2);
        }
        ans += lastDigit(n);
        return ans;
    }

    public static int digits(long n){
        int ans = 0;
        while(n > 0){
            ++ans;
            n /= 10;
        }
        return ans;
    }

    public static long lastDigit(long n){

        long m = n;
        long r = m % 10;
        long l = 0;

        while (m >= 10){
            m /= 10;
        }

        l = m;

        long ans = (l - 1) * (long)Math.pow(10, digits(n) - 2);
        long k = Long.parseLong(Long.toString(n).substring(1)) / 10;
        if (l > r){
          return k + ans;
        }else {
            return k + ans + 1;
        }
    }
}

/*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;

public class test1 {
	static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static long mod=(long)1e9+7;
	static long mod1=998244353;
	static boolean sieve[];
	static ArrayList<Integer> primes;
	static ArrayList<Long> factorial;
/****************************************Solutions Begins***************************************************/
	static long dp[][][];
	static ArrayList<Long> num;
	static int s=0;

	static long helper(int pos,int fdig,int small){
		if(pos==s&&s==1){
			return 1;
		}
		if(pos==s-1){
			if(small==0||fdig<=num.get(pos)){
				return 1;
			}
			else{
				return 0;
			}
		}
		if(dp[pos][fdig][small]!=-1){
			return dp[pos][fdig][small];
		}

		long ans=0;
		if(small==0){
			for(int i=0;i<=9;i++){
				ans+=helper(pos+1,fdig,0);
			}
		}
		else{
			for(int i=0;i<=9;i++){
				if(i<num.get(pos)){
					ans+=helper(pos+1,fdig,0);
				}
				else if(i==num.get(pos)){
					ans+=helper(pos+1,fdig,1);
				}
			}
		}
		dp[pos][fdig][small]=ans;
		return ans;
	}
	static long f(long n){
		num=new ArrayList<>();
		long n1=n;
		while(n1!=0){
			long k=n1%10;
			num.add(k);
			n1/=10;
		}
		Collections.reverse(num);
		dp=new long[20][10][2];

		//debug(num);

		long ans=0;
		for(int i=1;i<=num.size();i++){
			s=i;
		for(long arr[][]:dp){
			for(long ar[]:arr){
				Arrays.fill(ar,-1);
			}
		}
			for(int j=1;j<=9;j++){
				if(j<num.get(0)||i<num.size()){
					ans+=helper(1,j,0);
				}
				else if(j==num.get(0)){
					ans+=helper(1,j,1);
				}
			}
		}
		return ans;
	}
	public static void main (String[] args) throws Exception {
		String st[]=br.readLine().split(" ");
		long l=Long.parseLong(st[0]);
		long r=Long.parseLong(st[1]);
		//out.println(f(9));
		//out.println(f(47));
		//out.println(f(l));
		out.println(f(r)-f(l-1));

/****************************************Solutions Ends*****************************************************/
		out.flush();
		out.close();
    }
/****************************************Template Begins***************************************************/

/*******************************************************TRIPLET********************************************/
	static class tripletComparator implements Comparator<triplet>{
		public int compare(triplet p1,triplet p2){
			if(p1.u<p2.u){
				return 1;
			}
			else if(p1.u>p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class triplet{
		int u;
		int v;
		int i;
		public triplet(int u,int v,int i){
			this.u=u;
			this.v=v;
			this.i=i;
		}
		public String toString() {
			return "[u=" + u + ", v=" + v + ", i="+i+"]";
		}
	}
/*********************************************PAIR*************************************************/
	static class PairComp implements Comparator<Pair>{
		public int compare(Pair p1,Pair p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class Pair implements Comparable<Pair> {
		int u;
		int v;
		int index=-1;
		public Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*******************************************LONG PAIR******************************************/
	static class PairCompL implements Comparator<Pairl>{
		public int compare(Pairl p1,Pairl p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
static class Pairl implements Comparable<Pair> {
		long u;
		long v;
		int index=-1;
		public Pairl(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*****************************************DEBUG***********************************************************/
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
/*****************************************NUMBER THEORY***********************************************/

/************************************MODULAR EXPONENTIATION************************************/
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
/*********************************************GCD*****************************/
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}
/*******************************************SIEVE*********************************/
	static void sieveMake(int n){
		sieve=new boolean[n];
		Arrays.fill(sieve,true);
		sieve[0]=false;
		sieve[1]=false;
		for(int i=2;i*i<n;i++){
			if(sieve[i]){
				for(int j=i*i;j<n;j+=i){
					sieve[j]=false;
				}
			}
		}
		primes=new ArrayList<Integer>();
		for(int i=0;i<n;i++){
			if(sieve[i]){
				primes.add(i);
			}
		}
	}
/***************************************FACTORIAL*********************************************************/
	static void fact(int n){
		factorial=new ArrayList<>();
		factorial.add((long)1);
		for(int i=1;i<=n;i++){
			factorial.add((factorial.get(i-1)*i)%mod);
		}
	}
/*******************************************ncr*********************************************************/
	static long ncr(int n,int k){
		long aa=modulo(factorial.get(n-k),mod-2,mod);
		long bb=modulo(factorial.get(k),mod-2,mod);
		long cc=factorial.get(n);
		long ans=(aa*cc)%mod;
		ans=(ans*bb)%mod;
		return ans;
	}
/***************************************STRING REVERSE****************************************************/
	static String reverse(String str){
		char r[]=new char[str.length()];
		int j=0;
		for(int i=str.length()-1;i>=0;i--){
			r[j]=str.charAt(i);
			j++;
		}
		return new String(r);
	}
}
/*******************************************************End***********************************************************/

import java.util.Scanner;

import static java.lang.System.out;

/**
 * 204A
 *
 * @author artyom
 */
public class LittleElephantAndInterval {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long p = sc.nextLong(), q = sc.nextLong(), count = 0, bruteForceUpperLimit = Math.min(q, 99);
        if (q < 10) {
            out.println(q - p + 1);
            return;
        }
        while (p <= bruteForceUpperLimit) {
            if (satisfies(p)) {
                count++;
            }
            p++;
        }
        long t = p;
        while (t % 10 > 0) {
            t++;
        }
        long s = q;
        while (s % 10 > 0) {
            s--;
        }
        count += (s - t) / 10;
        while (p < t) {
            if (satisfies(p)) {
                count++;
            }
            p++;
        }
        while (q > s) {
            if (satisfies(q)) {
                count++;
            }
            q--;
        }
        out.println(count);
    }

    private static boolean satisfies(long num) {
        String str = String.valueOf(num);
        return (str.charAt(0) == str.charAt(str.length() - 1));
    }
}

import java.io.*;
import java.util.StringTokenizer;
import static java.util.Arrays.*;

public class Main {

    long res[] = new long[111];

    long fun(long i) {
        if (i >= 0L && i <= 100L) return res[(int)i];

        long p = 1;
        while (p*10 > 0 && p*10 <= i) p*=10;

        while (i/p != i%10) {
            i--;

            if (i <= 10) return i;

            p = 1;
            while (p*10 > 0 && p*10 <= i) p*=10;
        }

        if (i <= 10) return i;
        if (i <= 100) return res[(int)i];

        long hwm = i%10;

        i = i%p;
        i = i/10;

        p = p/10;

        return (i+1) + p*(hwm-1) + fun(p*10);
    }

    boolean isOk(long i) {
        if (i < 10) return true;

        long p = 1;
        while (p*10 > 0 && p*10 <= i) p*=10;

        if (i/p == i%10) return true;

        return false;
    }

    void solve() throws IOException {
        long l = nextLong();
        long r = nextLong();

        for (int i = 0; i < 10; ++i) {
            res[i] = i+1;
        }

        for (int i = 10; i <= 100; ++i) {
            res[i] = res[i-1];
            if (i/10 == i%10) res[i]++;
        }

//      System.out.println(isOk(l));
        System.out.println(fun(r) - fun(l) + (isOk(l) ? 1 : 0));
//      System.out.println(fun(l));
//      System.out.println(fun(r));
    }

    class MultiList {
        int[] head, next, dest;
        int en;

        MultiList(int vNum, int eNum) {
            head = new int[vNum];
            next = new int[eNum + 1];
            dest = new int[eNum + 1];
            clearGraph();
        }

        void clearGraph() {
            fill(head, -1);
            en = 0;
        }

        void addEdge(int u, int v) {
            dest[en] = v;
            next[en] = head[u];
            head[u] = en;
            en++;
        }
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileIn = "input.txt";
    final String fileOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        if (new File(fileIn).exists())
            in = new BufferedReader(new FileReader(fileIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
//      out = new PrintWriter(new FileWriter(fileOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        long l = in.nextLong();
        long r = in.nextLong();
        String s;
        while (true) {
            s = l + "";
            if (s.charAt(0) == s.charAt(s.length() - 1))
                break;
            l++;
        }
        while (true) {
            s = r + "";
            if (s.charAt(0) == s.charAt(s.length() - 1))
                break;
            r--;
        }
        if (l > r)
            System.out.println(0);
        else if (l == r)
            System.out.println(1);
        else if (l <= 10 && r <= 10) {
            long res = r - l + 1;
            if (r == 10 && l == 10)
                res--;
            if (r == 10 && l != 10)
                res--;
            System.out.println(res);
        } else {
            long res = 0;
            boolean t = false;
            while (l < 11) {
                l++;
                res++;
                t = true;
            }
            if (t)
                res--;
            String[] ni = new String[19];
            String[] z = new String[19];
            ni[0] = "";
            z[0] = "";
            for (int i = 1; i < ni.length; i++)
                ni[i] = ni[i - 1] + "9";
            for (int i = 1; i < ni.length; i++)
                z[i] = z[i - 1] + "0";
            s = l + "";
            int len = s.length() - 2;
            long cur = l;
            char d = s.charAt(0);
            long nxt;
            for (int i = len;; i++) {
                nxt = Long.parseLong(d + ni[len] + d);
                if (nxt < r) {
                    if (len == 0)
                        res++;
                    else {
                        String s1 = nxt + "";
                        String s2 = cur + "";
                        String ss1 = s1.substring(1, s1.length() - 1);
                        String ss2 = s2.substring(1, s2.length() - 1);
                        long a1 = 0, a2 = 0;
                        if (ss1.length() != 0)
                            a1 = Long.parseLong(ss1);
                        if (ss2.length() != 0)
                            a2 = Long.parseLong(ss2);
                        res += a1 - a2 + 1;
                    }
                    if (d == '9') {
                        len++;
                        d = '1';
                    } else
                        d++;
                    cur = Long.parseLong(d + z[len] + d);
                } else {
                    String s1 = r + "";
                    String s2 = cur + "";
                    String ss1 = s1.substring(1, s1.length() - 1);
                    String ss2 = s2.substring(1, s2.length() - 1);
                    long a1 = 0, a2 = 0;
                    if (ss1.length() != 0)
                        a1 = Long.parseLong(ss1);
                    if (ss2.length() != 0)
                        a2 = Long.parseLong(ss2);
                    res += a1 - a2 + 1;
                    break;
                }
            }
            System.out.println(res);
        }
    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer st;

        public InputReader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer(in.readLine());
        }

        public String next() throws IOException {
            while (!st.hasMoreElements())
                st = new StringTokenizer(in.readLine());
            return st.nextToken();
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}

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

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class A204_1
{

	public static long mod = 1000000007;
	public static long INF = (1L << 60);
	static FastScanner2 in = new FastScanner2();
	static OutputWriter out = new OutputWriter(System.out);
	static String w;
	static long[][][] dp;
	public static long func(int initial,int remains,boolean lessthan)
	{
		if(remains==1)
		{
			if(initial==0)
			{
				if(lessthan)
				{
					return 9;
				}
				else
				{
					//only for single digit number
					if(w.length()>1)
						System.out.println("assump wrong");
					return w.charAt(w.length()-1)-'0';
				}
			}
			else
			{
				//initial is non zero
				if(lessthan)
				{
					return 1;
				}
				else
				{
					return initial<=w.charAt(w.length()-1)-'0'?1:0;
				}
			}
		}
		if(dp[initial][remains][lessthan?1:0]!=-1)
			{
			return dp[initial][remains][lessthan?1:0];
			}
		long answer=0;
		for(int i=0;i<(lessthan?10:w.charAt(w.length()-remains)-'0'+1);i++)
		{
			answer+=func(initial==0?i:initial, remains-1, lessthan?lessthan:(i!=w.charAt(w.length()-remains)-'0'));
		}
		return dp[initial][remains][lessthan?1:0]=answer;

	}
	public static void main(String[] args)
	{

		long a=in.nextLong();
		long b=in.nextLong();
		dp=new long[10][20][2];
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<20;j++)
			{
				Arrays.fill(dp[i][j], -1);
			}
		}
		w=b+"";
		long ans1=func(0, w.length(), false);
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<20;j++)
			{
				Arrays.fill(dp[i][j], -1);
			}
		}
		a--;
		w=a+"";
		long ans2=func(0, w.length(), false);
		out.println(ans1-ans2);
		out.close();

	}

	public static long pow(long x, long n)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p))
		{
			if ((n & 1) != 0)
			{
				res = (res * p);
			}
		}
		return res;
	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FastScanner2
	{
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

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

		public String nextLine()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n)
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextLong();
			}
			return arr;
		}

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

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

	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream)
		{
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine()
		{
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					fullLine = reader.readLine();
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next()
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

		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 int nextInt()
		{
			return Integer.parseInt(next());
		}
	}

	static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}
	}

}

import java.util.Arrays;
import java.util.Scanner;

public class A204_CC
{
	static long[][][] dp;
	static char[] num;
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		System.out.println(get(b) - get(a-1));
	}

	private static long get(long n)
	{
		if (n == 0)
			return 0;
		num = (""+n).toCharArray();
		for (int i = 0; i < num.length; i++)
			num[i] -= '0';
		dp = new long[num.length][10][2];
		for (int i = 0; i < dp.length; i++)
			for (int j = 0; j < dp[0].length; j++)
				Arrays.fill(dp[i][j], -1);

		return under(0, 0, 1);
	}

	private static long under(int ind, int first, int bound)
	{
		if (dp[ind][first][bound] >= 0)
			return dp[ind][first][bound];
		long ans = 0;
		int b = bound == 1 ? num[ind] : 9;
		for (int i = 0; i <= b; i++)
		{
			if (ind == num.length-1)
			{
				if (i != 0)
				{
					if (i == first || first == 0)
						ans++;
				}
			}
			else
			{
				ans += under(ind+1, first == 0 ? i : first, bound == 1 && i == b ? 1 : 0);
			}
		}

		return dp[ind][first][bound] = ans;
	}
}

import java.util.Scanner;

public class Main {
	public static int N;
	public static String str;
	public static long[][][][] dp;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		long l = s.nextLong();
		l--;
		str = Long.toString(l);
		N = str.length();
		dp = new long[N][10][10][2];
		for (int a = 0; a < N; a++) {
			for (int b = 0; b <= 9; b++) {
				for (int c = 0; c <= 9; c++) {
					for (int d = 0; d < 2; d++) {
						dp[a][b][c][d] = -1;
					}
				}
			}
		}
		long res1 = dfs(0, 0, 0, true);
		str = s.next();
		N = str.length();
		dp = new long[N][10][10][2];
		for (int a = 0; a < N; a++) {
			for (int b = 0; b <= 9; b++) {
				for (int c = 0; c <= 9; c++) {
					for (int d = 0; d < 2; d++) {
						dp[a][b][c][d] = -1;
					}
				}
			}
		}
		long res2 = dfs(0, 0, 0, true);
		System.out.println(res2 - res1);
	}

	public static long dfs(int i, int first, int last, boolean restricted) {
		if (i == N) {
			if (first == last)
				return 1;
			return 0;
		}
		int r = 0;
		if (restricted)
			r = 1;
		if (dp[i][first][last][r] != -1) {
			return dp[i][first][last][r];
		}
		long res = 0;
		if (restricted) {
			for (int k = 0; k <= str.charAt(i) - '0'; k++) {
				if (k == str.charAt(i) - '0') {
					if (first == 0)
						res += dfs(i + 1, k, k, true);
					else
						res += dfs(i + 1, first, k, true);
				} else {
					if (first == 0)
						res += dfs(i + 1, k, k, false);
					else
						res += dfs(i + 1, first, k, false);
				}
			}
		} else {
			for (int k = 0; k <= 9; k++) {
				if (first == 0)
					res += dfs(i + 1, k, k, false);
				else
					res += dfs(i + 1, first, k, false);
			}
		}
		dp[i][first][last][r] = res;
		return res;
	}
}

import java.io.*;
import java.util.*;

public class Main {
//	static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}
	static BufferedReader in;
	static PrintWriter out;

	public static void main(String[] args) throws Exception {
//		in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		String[] s = in.readLine().split(" ");
		long l = Long.parseLong(s[0]);
		long r = Long.parseLong(s[1]);

		if (r - l <= 40) {
			int count = 0;
			for (long x = l; x <= r; x++) {
				int t = (int)(x % 10);
				long xx = x;
				while (xx >= 10) xx /= 10;
				if (xx == t) count++;
			}

			out.println(count);
		} else {
			long count = 0;

			while (l < 10) {
				count++;
				l++;
			}
			while (l % 10 != 0) {
				int t = (int)(l % 10);
				long xx = l;
				while (xx >= 10) xx /= 10;
				if (xx == t) count++;
				l++;
			}
			while (r % 10 != 9) {
				int t = (int)(r % 10);
				long xx = r;
				while (xx >= 10) xx /= 10;
				if (xx == t) count++;
				r--;
			}
			count += (r + 1- l)/10;
			out.println(count);
		}

		out.close();
	}
}

import java.io.*;
public class ele{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
String b = lector.readLine();
String a = b.substring(b.indexOf(" ")+1);
b = b.substring(0,b.indexOf(" "));
long res = ((a.length()>1)?((a.charAt(0)<=a.charAt(a.length()-1))?1:0)+9:a.charAt(0)-'0'+1)-((b.length()>1)?((b.charAt(0)<=b.charAt(b.length()-1))?1:0)+9:b.charAt(0)-'0'+1);
if(a.length()>1)
res+= (long)(a.charAt(0)-'0')*(long)Math.pow(10,a.length()-2)+Long.parseLong((a.length()==2)?"0":a.substring(1,a.length()-1));
if(b.length()>1)
res-=(long)(b.charAt(0)-'0')*(long)Math.pow(10,b.length()-2)+Long.parseLong((b.length()==2)?"0":b.substring(1,b.length()-1));
System.out.println(res+((b.charAt(0)==b.charAt(b.length()-1))?1:0));
}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class a {
	long ans(long x) {
		long t = 1;
		int i = 0;
		for(; t <= x/10; t*=10, i++);

	//	debug(x, t, i);
		if (t == 1) {
			return x;
		}
/*
		if (x % t == 0 && x > t) {
			return val(10).pow(i > 2 ? i-2 : 0).longValue() + ans(x - t);
		}
		*/
		if (x % t == 0) {
			return ans(x-1);
		}

		long tmp = x - t * (x/t);
		tmp = tmp / 10 + (tmp % 10 >= x/t ? 1 : 0);

		//debug(x, tmp);
		return tmp + ans(x-x%t);
	}
	void do_solve() throws NumberFormatException, IOException {
		long l = _long();
		long r = _long();
		out.println(ans(r) - ans(l-1));
	}

	void debug(Object... o) {
		System.err.println(Arrays.deepToString(o));
	}

	void mainProgram() throws NumberFormatException, IOException {
		/*
		test("a.in");
		 */
		try {
			init(true, "a");
		} catch (Exception e) {
			init(false, "");
		}
		boolean multy = false;

		if (!multy) {
			while (in.ready() || st.hasMoreTokens()) {
				do_solve();
			}
		} else {
			for (int T = _int(); T > 0; --T) {
				do_solve();
			}
		}
		out.close();
	}

	void init(boolean FILE, String name) throws NumberFormatException,
			IOException {
		Locale.setDefault(Locale.US);
		if (FILE) {
			in = new BufferedReader(new FileReader(name + ".in"));
			out = new PrintWriter(name + ".out");
		} else {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}
		st = new StringTokenizer("");
	}

	void test(String name) throws IOException {
		out = new PrintWriter(new File(name));

		out.close();
	}

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		long T = System.currentTimeMillis();
		new a().mainProgram();
		System.err.println("Time of working: "
				+ (System.currentTimeMillis() - T) + " ms");
	}

	String _token() throws IOException {
		while (in.ready() && !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		if (st.hasMoreTokens())
			return st.nextToken();
		return "";
	}

	BigInteger add(BigInteger A, BigInteger B) {
		return A.add(B);
	}

	BigInteger mult(BigInteger A, BigInteger B) {
		return A.multiply(B);
	}

	BigInteger sub(BigInteger A, BigInteger B) {
		return A.subtract(B);
	}

	BigInteger div(BigInteger A, BigInteger B) {
		return A.divide(B);
	}

	BigInteger mi(BigInteger A) {
		return (BigInteger.ZERO).subtract(A);
	}

	BigInteger sq(BigInteger A) {
		return A.multiply(A);
	}

	BigInteger val(long a) {
		return BigInteger.valueOf(a);
	}

	int cmp(BigInteger a, BigInteger b) {
		return a.compareTo(b);
	}

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	int _int() throws NumberFormatException, IOException {
		return Integer.parseInt(_token());
	}

	long _long() throws NumberFormatException, IOException {
		return Long.parseLong(_token());
	}

	double _double() throws NumberFormatException, IOException {
		return Double.parseDouble(_token());
	}

	int gcd(int a, int b) {
		if (a < 0)
			a = -a;
		if (b < 0)
			b = -b;
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	long gcd(long a, long b) {
		if (a < 0)
			a = -a;
		if (b < 0)
			b = -b;
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	BigInteger gcd(BigInteger a, BigInteger b) {
		if (cmp(a, val(0)) < 0)
			a = mi(a);
		if (cmp(b, val(0)) < 0)
			b = mi(b);
		return a.gcd(b);
	}
}

import java.io.BufferedInputStream;
import java.util.Arrays;

public class C204A {

	public void solve() throws Exception {
		long l = nextLong();
		long r = nextLong();
		println(f(r) - f(l - 1));
	}

	public long f(long x) {
		if (x < 10) {
			return x;
		}
		String s = Long.toString(x);
		return x / 10 + 8 + (s.charAt(0) <= s.charAt(s.length() - 1) ? 1 : 0);
	}

	// ------------------------------------------------------

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	void print(Object... os) {
		if (os != null && os.length > 0)
			System.out.print(os[0].toString());
		for (int i = 1; i < os.length; ++i)
			System.out.print(" " + os[i].toString());
	}

	void println(Object... os) {
		print(os);
		System.out.println();
	}

	BufferedInputStream bis = new BufferedInputStream(System.in);

	String nextWord() throws Exception {
		char c = (char) bis.read();
		while (c <= ' ')
			c = (char) bis.read();
		StringBuilder sb = new StringBuilder();
		while (c > ' ') {
			sb.append(c);
			c = (char) bis.read();
		}
		return new String(sb);
	}

	String nextLine() throws Exception {
		char c = (char) bis.read();
		while (c <= ' ')
			c = (char) bis.read();
		StringBuilder sb = new StringBuilder();
		while (c != '\n' && c != '\r') {
			sb.append(c);
			c = (char) bis.read();
		}
		return new String(sb);
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextWord());
	}

	long nextLong() throws Exception {
		return Long.parseLong(nextWord());
	}

	public static void main(String[] args) throws Exception {
		new C204A().solve();
	}
}

import java.util.Scanner;

public class C {

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		p = new long[20];
		p[0] = 1;
		for (int i = 1; i < p.length; i++)
			p[i] = 10 * p[i - 1];
		System.out.println(count(b) - count(a - 1));
	}

	static long[] p;

	private static long count(long n)
	{
		if (n < 10)
			return n;
		String s = n + "";
		int len = s.length();
		long ret = 9;
		int first = s.charAt(0) - '0';
		for (int i = 1; i <= first; i++)
			if (i < first)
			{
				ret += p[len - 2];
			} else if (i == first && i <= s.charAt(len - 1) - '0')
			{
				if (len > 2)
					ret += Long.parseLong(s.substring(1, len - 1)) + 1;
				else
					ret++;
			} else if (len > 2)
			{
				ret += Long.parseLong(s.substring(1, len - 1));
			}
		for (int i = 2; i < len; i++)
			ret += 9 * p[i - 2];
		return ret;
	}

}

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

import static java.lang.Math.*;

public class Main implements Runnable {

	long solve(long to) {
		long answer = 0;
		answer += min(9, to);
		for (int i = 1; i <= 9; i++) {
			long pow10 = 1;
			for (int j = 0; j <= 16; j++) {
				long smallest = i * pow10 * 10 + i;
				long largest = (i * pow10 + pow10 - 1) * 10 + i;
				if (largest <= to) {
					answer += pow10;
					//out.println(smallest + " " + largest + " " + answer);
				} else if (smallest <= to) {
					long l = 0, r = pow10;
					while (r - l > 1) {
						long m = l + (r - l) / 2;
						long mnum = (i * pow10 + m) * 10 + i;
						if (mnum <= to) {
							l = m;
						} else {
							r = m;
						}
					}
					answer += l + 1;
					//out.println(smallest + " " + largest + " " + answer);
				}
				//out.println(answer);
				//out.println(smallest + " " + largest);
				pow10 *= 10;
			}
		}
		return answer;
	}

	long solve(long l, long r) {
		return solve(r) - solve(l - 1);
	}

	long naiveSolve(long l, long r) {
		long answer = 0;
		for (long i = l; i <= r; i++) {
			long pow10 = 1;
			while (pow10 * 10 <= i) {
				pow10 *= 10;
			}
			if (i / pow10 == i % 10) {
				answer++;
				//out.println(i);
			}
		}
		return answer;
	}

	void solve() throws Exception {
		long l = sc.nextLong(), r = sc.nextLong();
		//out.println(naiveSolve(l, r));
		out.println(solve(l, r));
	}

	BufferedReader in;
	PrintWriter out;
	FastScanner sc;

	static Throwable uncaught;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Main.uncaught = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
		t.start();
		t.join();
		if (uncaught != null) {
			throw uncaught;
		}
	}

}

class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

}

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

public class ProblemA {

    static long pow(long a, long cm) {
        long x = 1;
        for (long i = 0 ; i < cm ; i++) {
            x *= a;
        }
        return x;
    }

    public static long solve(long x) {
        long xx = x;
        if (x <= 0) {
            return 0;
        }

        int keta = 0;
        while (x >= 1) {
            x /= 10L;
            keta++;
        }

        long ans = 0;
        for (int i = 1 ; i <= keta - 1 ; i++) {
            long med = (i <= 2) ? 0 : i - 2;
            ans += 9L * pow(10L, med);
        }

        String sx = String.valueOf(xx);
        long head = (sx.charAt(0) - '0');
        long tail = (sx.charAt(sx.length()-1) - '0');

        ans += (head - 1) * pow(10L, Math.max((keta - 2), 0));
        if (keta >= 3) {
            ans += (Long.valueOf(sx.substring(1, sx.length()-1)));
            if (head <= tail) {
                ans++;
            }
        } else {
            if (head <= tail) {
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] line = s.readLine().split(" ");

        long l = Long.valueOf(line[0]);
        long r = Long.valueOf(line[1]);

        long ans = solve(r) - solve(l-1);
        System.out.println(ans);
    }
}

//package round129;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;

public class A {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		out.println(-count(nl()-1) + count(nl()));
	}

	long count(long n)
	{
		if(n < 10)return n;
		int top = Long.toString(n).charAt(0)-'0';
		long u = Long.parseLong(Long.toString(n).substring(1)) / 10;
		if(n % 10 >= top){
			u++;
		}
		long d, f;
		u += 9;
		for(d = 10, f=9;d <= n/10;d*=10,f*=10){
			u += f;
		}
		u += f / 9 * (top-1);
		return u;
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{
		new A().run();
	}

	public int ni()
	{
		try {
			int num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public long nl()
	{
		try {
			long num = 0;
			boolean minus = false;
			while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));
			if(num == '-'){
				num = 0;
				minus = true;
			}else{
				num -= '0';
			}

			while(true){
				int b = is.read();
				if(b >= '0' && b <= '9'){
					num = num * 10 + (b - '0');
				}else{
					return minus ? -num : num;
				}
			}
		} catch (IOException e) {
		}
		return -1;
	}

	public String ns()
	{
		try{
			int b = 0;
			StringBuilder sb = new StringBuilder();
			while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));
			if(b == -1)return "";
			sb.append((char)b);
			while(true){
				b = is.read();
				if(b == -1)return sb.toString();
				if(b == '\r' || b == '\n' || b == ' ')return sb.toString();
				sb.append((char)b);
			}
		} catch (IOException e) {
		}
		return "";
	}

	public char[] ns(int n)
	{
		char[] buf = new char[n];
		try{
			int b = 0, p = 0;
			while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));
			if(b == -1)return null;
			buf[p++] = (char)b;
			while(p < n){
				b = is.read();
				if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;
				buf[p++] = (char)b;
			}
			return Arrays.copyOf(buf, p);
		} catch (IOException e) {
		}
		return null;
	}

	double nd() { return Double.parseDouble(ns()); }
	boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class  Little_Elephant_and_Interval
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);

		int t=1;

		while(t-->0)
		{

			String str[]=br.readLine().trim().split(" ");
			BigInteger a=giveme(Long.parseLong(str[1]));

			BigInteger b=giveme(Long.parseLong(str[0])-1);
			BigInteger c=a.add(new BigInteger("-"+b.toString()));
			pw.println(c.toString());
		}
		pw.flush();
	}

	public static BigInteger giveme(long x)
	{
		//double ans=0;
		String s=""+x;
		BigInteger ans = new BigInteger("0");
		if(Long.parseLong(s)<10)
			return ans=new BigInteger(s);
		char a[]=s.toCharArray();
		int n=s.length();

		for(long i=1;i<=n;i++)
		{
			if(i<n)
			{
				if(i-2<=0)
				{
					ans=ans.add(new BigInteger("9"));
				}
				else
				{
					ans=ans.add(new BigInteger(""+(9*(long)Math.pow(10,i-2))));
					//System.out.print(9*Math.pow(10,i-2)+" ");
				}
			}
			else
			{
				if(n==2)
				{
					ans=ans.add(new BigInteger(""+(x/11)));
					continue;
				}

				long p=Long.parseLong(""+a[0]);
				for(long j=1;j<p;j++)
				{
					ans=ans.add(new BigInteger(""+(long)Math.pow(10,i-2)));
				}

				String g=s.substring(1,n-1);
				ans=ans.add(new BigInteger(""+(Long.parseLong(g)+1)));

				if(Long.parseLong(""+a[0])>Long.parseLong(""+a[n-1]))
					ans=ans.add(new BigInteger("-1"));

			}
			//System.out.println(ans.toString());
		}

		return ans;
	}

}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	long getAns(long r) {
		if (r < 10)
			return r;
		if (r < 100) {
			long ret = 9;
			for (int i = 1; i < 10; i++)
				if (i * 10 + i <= r)
					ret++;
			return ret;
		}
		int len = String.valueOf(r).length();
		long ret = 9;
		long x = 9;
		for (int i = 0; i < len - 2; i++) {
			ret += x;
			x *= 10;
		}
		x /= 9;
		for (int i = 1; i < 10; i++) {
			if (r / x / 10 == i) {
				ret += r / 10 % x;
				if (r % 10 >= i)
					ret++;
				break;
			} else {
				ret += x;
			}
		}
		return ret;
	}

	boolean isLuck(long x) {
		return String.valueOf(x).charAt(0) == (x % 10 + '0');
	}

	private void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		out.println(getAns(r) - getAns(l) + (isLuck(l) ? 1 : 0));
	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    long cal(long c) {
        String s = c+"";
        int l = s.length();
        long r = min(9, c);
        long t = 1;
        for (int i=2; i<l; i++) {
            r += 9*t;
            t *= 10;
        }
        if (l==2) {
            r += c/11;
        } else if (l>2) {
            t = 1;
            for (int i=2; i<l; i++) t *= 10;

            int d = s.charAt(0)-'0';
            r += (d-1)*t+Long.parseLong(s.substring(1, l-1));
            if (s.charAt(0)<=s.charAt(l-1)) {
                r++;
            }
        }
        return r;
    }

    public A() throws Exception {
        long l = in.nextLong();
        long r = in.nextLong();
        System.out.println(cal(r)-cal(l-1));
    }

    Scanner in = new Scanner(System.in);
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer st;

    String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    long f(long a) {
        if (a < 10) return a;
        long ans = a / 10 - 1;
        int fd = Long.toString(a).charAt(0) - '0';
        if (fd <= a % 10) ans++;
        return ans + 9;
    }

    void solve() throws Exception {
        out.println(-f(nextLong() - 1) + f(nextLong()));
    }

    public void run() {
        try {
            Locale.setDefault(Locale.UK);
            in = new BufferedReader(new InputStreamReader(System.in));
            //in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(System.out);
            solve();
        } catch (Exception e) {
            e.printStackTrace(out);
            out.close();
            System.exit(0);
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new Thread(null, new Solution(), "1", 1 << 28).start();
    }

}

import java.util.Scanner;

public class xz {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long   l = sc.nextLong();
		long   r = sc.nextLong();
		long ans = solve(r) - solve(l-1);
		System.out.println(ans);

	}

	public static long solve(long x){
		String _x = String.valueOf(x);
		return  x/10 -1 + Math.min(9,x)+(_x.charAt(0) <= _x.charAt(_x.length() - 1) ? 1 : 0);

	}

}

import java.util.*;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskC {
    public long calc(long l, long r) {
        if (r == 0)
            return 0;
        long ret = 0;
        while (l/10 == 0 && l <= r) {
            l++;
            ret++;
        }
        while (l/100 == 0 && l <= r) {
            if (l/10 == l%10)
                ret++;
            l++;
        }
        while (num(l) < num(r)) {
            ret += 9 * num(l)/10;
            l = num(l) * 10 + 1;
            if(l == r)
                ret++;
        }
        while (l/num(l) < r/num(r)) {
            ret += num(l)/10;
            l = (l/num(l)+1) * num(l) + (l/num(l)+1);
            if (l == r)
                ret++;
        }
        if (r > 100 && l < r) {
            ret += (r%num(r))/10;
            if (r/num(r) <= r%10)
                ret++;
        }
        return ret;
    }

    private long num(long i) {
        long ret = 1;
        while (i/10 > 0) {
            i /= 10;
            ret *= 10;
        }
        return ret;
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long l, r;
        l = in.readInt();
        r = in.readInt();
        System.out.println(calc(1, r) - calc(1, (l - 1)));
    }
}

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 InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public long readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

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

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

class MiscUtils {

    public static void decreaseByOne(int[]...arrays) {
        for (int[] array : arrays) {
            for (int i = 0; i < array.length; i++)
                array[i]--;
        }
    }

}

//package a2oj_ladder_C;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TreeMap;
import java.util.TreeSet;

@SuppressWarnings("unused")
public class Elephant204A {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	int mod = (int)(Math.pow(10,9)+7);

	void solve()
	{
		long l = nl();
		long r = nl();
		long res = 0;

		if(l<10 && r<10) {
			out.println(r-l+1);
			return;
		}
		else if(l<10) {
			res += 10-l;
			l = 10;
		}
		//out.println(res);
		int ll = (l+"").length();
		int lr = (r+"").length();

		//out.println(ll+" "+lr);
		for(int i = ll+1 ; i<lr ; i++) {
			res += 9 * (long)Math.pow(10, i-2);
		}
		String sl = l+"";
		String sr = r+"";

		if(ll == lr) {
			if(sl.charAt(ll-1)<=sl.charAt(0)) res++;

			for(int i = 0 ; i<ll-1 ; i++) {
				res += (9-(sl.charAt(i)-'0')) * (long)Math.pow(10, (ll-i-2<0?0:ll-i-2));
			}

			long t = res;
			res = 0;

			if(sr.charAt(lr-1)<sr.charAt(0)) res++;

			for(int i = 0 ; i<lr-1 ; i++) {
				res += (9-(sr.charAt(i)-'0')) * (long)Math.pow(10, (lr-i-2<0?0:lr-i-2));
			}

			out.println(t-res);
			return;

		}

		//out.println(res);
		if(ll < lr) {
			if(sl.charAt(ll-1)<=sl.charAt(0)) res++;
			for(int i = 0 ; i<ll-1 ; i++) {
				//out.println((9-(sl.charAt(i)-'0')) * Math.pow(10, (ll-i-2<0?0:ll-i-2)));
				res += (9-(sl.charAt(i)-'0')) * (long)Math.pow(10, (ll-i-2<0?0:ll-i-2));
			}
		}
		//out.println("d"+res);
		if(sr.charAt(lr-1)>=sr.charAt(0)) res++;

		res += (sr.charAt(0)-'0'-1)*(long)Math.pow(10, (lr-2<0?0:lr-2));
		for(int i = 1 ; i<lr-1 ; i++) {
			res += (sr.charAt(i)-'0')*(long)Math.pow(10, (lr-i-2<0?0:lr-i-2));
		}
		out.println(res);
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new Elephant204A().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int[][] na(int n , int m)
	{
		int[][] a = new int[n][m];
		for(int i = 0;i < n;i++)
			for(int j = 0 ; j<m ; j++) a[i][j] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	void display2D(int a[][]) {
		for(int i[] : a) {
			for(int j : i) {
				out.print(j+" ");
			}
			out.println();
		}
	}

	int[][] creategraph(int n , int m) {
		int g[][] = new int[n+1][];

		int from[] = new int[m];
		int to[] = new int[m];
		int ct[] = new int[n+1];

		for(int i = 0 ; i<m; i++) {
			from[i] = ni();
			to[i] = ni();
			ct[from[i]]++;
			ct[to[i]]++;
		}

		int parent[] = new int[n+1];

		for(int i = 0 ; i<n+1 ; i++) g[i] = new int[ct[i]];

		for(int i = 0 ; i<m ; i++) {
			g[from[i]][--ct[from[i]]] = to[i];
			g[to[i]][--ct[to[i]]] = from[i];
		}

		return g;
	}

	static long __gcd(long a, long b)
	{

		if(b == 0)
		{
			return a;
		}
		else
		{
			return __gcd(b, a % b);
		}
	}

	// To compute x^y under modulo m
	static long power(long x, long y, long p)
	{

		// Initialize result
		long res = 1;

		// Update x if it is more than or
		// equal to p
		x = x % p;

		while (y > 0)
		{

			// If y is odd, multiply x
			// with result
			if (y % 2 == 1)
				res = (res * x) % p;

			// y must be even now
			y = y >> 1; // y = y/2
		x = (x * x) % p;
		}

		return res;
	}

	// Function to find modular
	// inverse of a under modulo m
	// Assumption: m is prime
	static long modInverse(long a, int m)
	{
		if (__gcd(a, m) != 1) {
			//System.out.print("Inverse doesn't exist");
			return -1;
		}

		else {

			// If a and m are relatively prime, then
			// modulo inverse is a^(m-2) mode m
			//			System.out.println("Modular multiplicative inverse is "
			//											+power(a, m - 2, m));
			return power(a, m - 2, m);
		}
	}

	static long nCrModPFermat(int n, int r,
			int p , long fac[])
	{

		// Base case
		if (r == 0)
			return 1;

		// Fill factorial array so that we
		// can find all factorial of r, n
		// and n-r
		long t = (fac[n]* modInverse(fac[r], p))%p;

		return ( (t* modInverse(fac[n-r], p))% p);
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

/*
Rohit Singh
29 December 2018
1523
*/
import java.util.* ;
import java.io.* ;

public class ElephantInterval
{
    static boolean debug = false ;
    public static void main(String args[]) throws Exception
    {
        BufferedReader bro = new BufferedReader(new InputStreamReader(System.in)) ;
        long[] arr = new long[18] ;
        arr[0] = 9L ;
        arr[1] = 18L ;
        for(int i=2;i<18;i++)
        {
            arr[i] = 9L*(long)Math.pow(10L,i-1) ;
            arr[i] = arr[i]+arr[i-1] ;
        }

        String[] S = bro.readLine().split(" ") ;
        long a = Long.parseLong(S[0]) ;
        long b = Long.parseLong(S[1]) ;
        long aA = getAns(a,arr) ;
        long bA = getAns(b,arr) ;
        if(debug)
        {
            System.out.println("arr :"+Arrays.toString(arr));
            System.out.println("aA :"+aA+" bA :"+bA);
            System.out.println("isGood :"+a+" "+isGood(a));
        }
        System.out.println((bA-aA+(isGood(a)?1:0)));
    }
    static boolean isGood(long a)
    {
        int digits = getDigits(a) ;
        long msd = a/(long)Math.pow(10,digits-1) ;
        long lsd = a%10 ;
        if(msd==lsd) return true ;
        else return false ;
    }
    static long getAns(long val,long[] arr)
    {
        int digits = getDigits(val) ;
        if(digits==1)
            return val ;
        long ans = arr[digits-2] ;
        long msd = val/(long)Math.pow(10L,digits-1) ;
        ans+=(msd-1)*(long)Math.pow(10L,digits-2) ;
        long lsd = val%10 ;
        long temp = (val%((long)Math.pow(10L,digits-1))/10) ;
        if(lsd>=msd) ans+=temp+1 ;
        else if(lsd<msd) ans+=temp ;
        return ans ;
    }
    static int getDigits(long val)
    {
        int d = 0 ;
        while(val!=0)
        {
            val/=10 ;
            d++ ;
        }
        return d ;
    }

}

import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author jarek
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long l = in.nextLong(), r = in.nextLong();
        out.print(calc(l, r));
    }

    public long calc(long min, long max) {
        if (min < 10 & max < 10) return max - min + 1;
        long inc = min < 10 ? 10 - min : 0;
        min += inc;
        long ans = inc + max / 10L - min / 10L;
        ans -= 1;
        if (testfirst(min)) ans += 1;
        if (testlast(max)) ans += 1;
        return ans;
    }

    public boolean testfirst(long n) {
        String s = String.valueOf(n);
        if (s.charAt(s.length() - 1) <= s.charAt(0)) return true;
        return false;
    }

    public boolean testlast(long n) {
        String s = String.valueOf(n);
        if (s.charAt(s.length() - 1) >= s.charAt(0)) return true;
        return false;
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader(File f) {
        try {
            br = new BufferedReader(new FileReader(f));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public InputReader(InputStream f) {
        br = new BufferedReader(new InputStreamReader(f));
    }

    public String next() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void close() {
        writer.close();
    }
}

import java.util.Scanner;

public class A_Little_Elephant_and_Interval {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        String left = a-1+"";
        String right = b+"";
        System.out.println(calc(right)-calc(left));

    }
    private static long calc(String s) {
        long res = 0;
        if (s.length() == 1){
            return Integer.parseInt(s);
        }
        if (s.length() == 2){
            res = 9 + s.codePointAt(0)-49;
            if (s.charAt(0) <= s.charAt(1)){
                res ++;
            }
            return res;
        }
        long a = 0;
        if (s.charAt(0) > s.charAt(s.length()-1)){
            a = Long.parseLong(s.substring(0,s.length()-1))-1;
            String t = a+"";
            t += t.charAt(0);
            s = t;
        }
        String t = s.substring(1,s.length()-1);
        res += Long.parseLong(t)+1;
        res += (s.codePointAt(0)-49)*(long)Math.pow(10, t.length());
        for (int i = 1; i < t.length(); i++) {
            res += 9*(long)Math.pow(10, i);
        }
        res += 18;
        return res;
    }

}
/*
458985985498001244 985458425544874008
ans
52647244004687276
10001 10000002
ans
999001

1 1000000000000000000
999999999999999999
ans
100000000000000008

*/

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	long f(long a) {
		if (a < 10) return a;
		long ans = a / 10 - 1;
		int fd = Long.toString(a).charAt(0) - '0';
		if (fd <= a % 10) ans++;
		return ans + 9;
	}

	void solve() throws Exception {
		out.println(-f(nextLong() - 1) + f(nextLong()));
	}

	public void run() {
		try {
			Locale.setDefault(Locale.UK);
			in = new BufferedReader(new InputStreamReader(System.in));
			//in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace(out);
			out.close();
			System.exit(0);
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Solution(), "1", 1 << 28).start();
	}

}

import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class ProblemC {
    void run() {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        BigInteger out = countNumbers(r);
        out = out.subtract(countNumbers(l-1));
        p("%s\n", out);

    }

    BigInteger countNumbers(long bound) {
    	long total = 0;
    	if (bound < 0) {
    		return BigInteger.ZERO;
    	} else if (bound <= 100) {
    		for (int i=1; i<=bound; i++) {
    			String s = Integer.toString(i);
    			if (s.charAt(0) == s.charAt(s.length()-1)) {
    				total += 1;
    			}
    		}
    		return BigInteger.valueOf(total);
    	}

    	String s = Long.toString(bound);
    	int len = s.length();

    	int firstDigit = Integer.parseInt(s.substring(0, 1), 10);
    	int lastDigit = Integer.parseInt(s.substring(len-1, len), 10);

		total += (firstDigit - 1) * Math.pow(10, len - 2);

    	long middle = Long.parseLong(s.substring(1, len-1), 10);
    	d("Middle is %s", middle);
    	if (firstDigit <= lastDigit) {
    		total += middle + 1;
    	} else {
    		total += middle;
    	}

    	BigInteger z = countAllDigits(len);
    	z = z.add(BigInteger.valueOf(total));

    	return z;
    }

    BigInteger countAllDigits(int len) {

    	BigInteger total = BigInteger.ZERO;
    	for (int i=1; i<len; i++) {
    		d("Adding %s", 9 * Math.pow(10L, Long.valueOf(Math.max(i-2, 0))));
    		total = total.add(BigInteger.valueOf((long) (9L * Math.pow(10L, Long.valueOf(Math.max(i-2, 0))))));
    	}
    	d("Count all digits for length=%s, out=%s", len, total);
    	return total;
    }

    boolean debug = false;
    void p(String f, Object...params) {
        System.out.printf(f, params);
    }
    void d(Object...params) {
        if (debug) {
            p("DEBUG: %s\n", Arrays.deepToString(params));
        }
    }
    public ProblemC(String[] args) {
        if (args.length > 0 && args[0].equals("debug")) {
            debug = true;
        }
    }
    public static void main(String[] args) {
        new ProblemC(args).run();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	private BufferedReader reader;
	private StringTokenizer tokenizer;
	private PrintWriter pw;

    void solve() throws IOException {
    	long left = nextLong();
    	long right = nextLong();
    	pw.println(f(right) - f(left - 1));
	}

    private long f(long p) {
    	if (p < 10)
    	{
    		return p;
    	}

    	if (p < 100) {
    		long r = 9;
    		for (long i = 11; i <= p; i += 11) {
    			++r;
    		}
    		return r;
    	}

    	String rep = String.valueOf(p);
    	String sub = rep.substring(1);
    	long r = Long.valueOf(sub) / 10 + 1;
    	if (Integer.valueOf(rep.charAt(0)) > Integer.valueOf(rep.charAt(rep.length() - 1)))
    		--r;

    	r += (Long.valueOf(rep.substring(0, 1)) - 1) * tenpow(rep.length());
    	System.err.println("r val: " + r);
    	for (int i = 0; i < rep.length() - 1; ++i)
    		r += ai(i);

    	return r;
    }

    private long ai(int i) {
    	if (i < 2) return 9;

    	i -= 2;
    	long res = 90;
    	for (; i > 0; --i) {
    		res *= 10;
    	}
    	return res;
    }

    private long tenpow(int len) {
    	if (len < 3)
    		return 0;

    	len -= 2;
    	long res = 10;
    	for (int i = 1; i < len; ++i) {
    		res *= 10;
    	}
    	return res;
    }

	public void run() {
	    try {
	        reader = new BufferedReader(new InputStreamReader(System.in));
	        pw = new PrintWriter(System.out);
	        solve();
	        pw.close();
	        reader.close();
	    } catch (Exception e) {
	        e.printStackTrace();
	    }
	}

	public static void main(String[] args) {
	    new Main().run();
	}

	int nextInt() throws IOException {
	    return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
	    return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
	    return Double.parseDouble(nextToken());
	}

	String nextToken() throws IOException {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	        tokenizer = new StringTokenizer(reader.readLine());
	    }
	    return tokenizer.nextToken();
	}
}

import java.util.Scanner;

public class C_204A {
	static long pow[];
	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		long l = sc.nextLong()-1;
		long r = sc.nextLong();
		pow = new long[19];
		pow[1] = 9;
		for (int i = 2; i <=18; i++) {
			pow[i] =  9 * (long) Math.pow(10,i-2);
		}
		System.out.println(f(r+"")-f(l+""));
	}
	static long f(String s){
		long res = 0;
		if(s.length()<=1){
			return Integer.parseInt(s);
		}
		for (int i =1; i <=s.length()-1; i++) {
			res+= pow[i];
		}
		int first = s.charAt(0);
		int last = s.charAt(s.length()-1);
		res+=(first - 49) * (long) Math.pow(10, s.length()-2);
		long t = 0;
		if(1<s.length()-1){
			t = Long.parseLong(s.substring(1,s.length()-1));
		}
		if(first <= last) t++;
		if(t>0) res+=t;
		return res;
	}
}

import java.util.Scanner;
public class Main {
	public static void pln( Object obj ){
		System.out.println(obj) ;
	}
	private static Scanner ob;
	static String s ;
	static int N ;
	private static long calc(long a , long b ){
		s = String.valueOf(b);
		N = s.length();
		init();
		long Ans = go(0,0,1,0,0);
		s = String.valueOf(a-1);
		N = s.length();
		init();
		Ans -= go(0,0,1,0,0);
		return Ans ;
	}
	public static void main( String args[] ){
		ob = new Scanner( System.in );
		long l = ob.nextLong();
		long r = ob.nextLong();
		pln( calc(l,r) );
	}
	private static void init(){
		for( int i = 0 ; i < 20 ; i++ )
			for( int j = 0 ; j < 2 ; j++ )
				for( int k = 0 ; k < 2 ; k++ )
					for( int l = 0 ; l < 10 ; l++ )
						for( int m = 0 ; m < 10 ; m++ ) dp[i][j][k][l][m] = -1 ;
	}
	static long dp[][][][][] = new long [20][2][2][10][10];
	private static long go( int pos , int sml , int start , int first , int last ){
		if( pos == N ) return ( first == last ) ? 1 : 0  ;
		if( dp[pos][sml][start][first][last] != -1 ) return dp[pos][sml][start][first][last];
		int lim = sml == 1  ? 9 : s.charAt(pos) - 48 ;
		long ret = 0 ;
		if( start == 1 ){
			for( int i  = 1 ; i <= lim ; i++ )
				ret += go(pos+1,  ( (sml == 1 ) || i < lim) ? 1 : 0 , 0 , i,i);
			ret += go(pos+1,1,1,0,0);
		}else {
			for( int i  = 0 ; i <= lim ; i++ )
				ret += go(pos+1,  ( (sml == 1 ) || i < lim) ? 1 : 0 , 0 , first,i);
		}
		return dp[pos][sml][start][first][last] = ret ;
	}
}

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class a {
    public static int vertices=0;
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long l=s.nextLong();
        long r=s.nextLong();
        System.out.println((f(r)-f(l-1)));
    }
    public static long f(long n){
        if(n==0)
            return 0;
        long temp=n;
        int sum=0,check=0;
        while(temp!=0){
            temp/=10;
            sum++;
            if(temp/10==0&&temp!=0)
                check=(int)temp;
        }
        if(sum==1)
            return n;
         else{
             temp=n/10+9;
             if(check>n%10)
                 temp--;
             return temp;

        }
    }
  }

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class a {
    public static int vertices=0;
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long l=s.nextLong();
        long r=s.nextLong();
        System.out.println((f(r)-f(l-1)));
    }
    public static long f(long n){
        if(n==0)
            return 0;
        long temp=n;
        int sum=0,check=0;
        while(temp!=0){
            temp/=10;
            sum++;
            if(temp/10==0&&temp!=0)
                check=(int)temp;
        }
        if(sum==1)
            return n;
        else{
            temp=9;
            for(int i=2;i<sum;i++){
                temp+=(long)9*((long)Math.pow(10,i-2));
                //System.out.println(temp+"  fd "+check+"  "+(9*(Math.pow(10,i-2))));
            }
            //System.out.println(temp+"  fd "+check+"  ");
            temp+=(long)(check-1)*(long)Math.pow(10,sum-2);
            long temp1=n;
            n/=10;
            long sum1=n%(long)Math.pow(10,sum-2);
            temp+=sum1;
            temp++;
            if(temp1%10<check)
                temp--;
          // System.out.println(temp+"  fd "+check+"  "+sum1);
            return temp;
        }
    }
    public static long value(long n,int sum){
        int a[]=new int[sum];
        for(int i=0;i<sum;i++){
            a[i]=(int)n%10;
            n/=10;
        }
        long temp=1;
        for(int i=1;i<sum-1;i++)
           temp*=(a[i]+1);
        System.out.println(temp);
        return temp;
    }
  }

import java.util.Scanner;

public class Main {

    public static long getWays(long n){
        char[] chs = (n + "").toCharArray();

        if(chs.length <= 2){
            return chs[0] - '1' +  (chs[0] > chs[chs.length - 1]? 0: 1);
        }

        long res = (chs[0] - '1') * Math.round(Math.pow(10, chs.length - 2));

        for(int i = 1; i + 1 < chs.length; i++){
            res += (chs[i] - '0') * Math.round(Math.pow(10, chs.length - 2 - i));
        }

        return res + (chs[0] > chs[chs.length - 1]? 0: 1);
    }

    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);

        long l = scan.nextLong();
        long r = scan.nextLong();

        long[] ways = {0, 9, 9, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000, 9000000000L, 90000000000L,900000000000L,9000000000000L,90000000000000L,900000000000000L,9000000000000000L,90000000000000000L,900000000000000000L,9000000000000000000L};

        for(int i = 1; i < ways.length; i++) ways[i] += ways[i - 1];

        long res = (ways[Long.valueOf(r ).toString().length() - 1] + getWays(r) - ways[Long.valueOf(l - 1).toString().length() - 1] - getWays(l - 1));

        System.out.print(res);

    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        long left = jin.nextLong();
        long right = jin.nextLong();

        jout.println(compute(right) - compute(left - 1));
    }

    private long compute(long value) {
        if (value < 10) {
            return value;
        } else if (value < 100) {
            long first = value / 10;
            long second = value % 10;

            long result = 9 + first;
            if (second < first)
                result--;
            return result;
        } else {
            String sVal = Long.toString(value);
            int len = sVal.length();
            String tmp = sVal.substring(1, len - 1);
            long result = computeLen(len - 1);
            long tot = 1;
            if (tmp.length() > 0) {
                tot = (long) Math.pow(10, tmp.length());
            }
            long first = sVal.charAt(0) - '0';
            long last = sVal.charAt(len - 1) - '0';
            result += tot * (first - 1);
            if (tmp.length() > 0) {
                long midVal = Long.parseLong(tmp);
                if (midVal > 0) {
                    result += midVal;
                }
            }
            if (last >= first) result++;
            return result;
        }
    }

    private long computeLen(int len) {
        if(len == 1) return 9;
        if(len == 2) return 18;
        return 9 * (long)Math.pow(10, len - 2) + computeLen(len - 1);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_204A solver = new CF_204A();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_204A {
        long[] tenPower = power(19);

        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            long l = in.l(), r = in.l();
            out.println(cal(r) - cal(l - 1));
        }

        long cal(long mx) {
            if (mx < 10) return mx;
            long ten = 1, ans = 0;
            int digits = 1;
            while (ten <= mx) {
                for (int i = 1; i <= 9 && i * ten <= mx; ++i) {
                    if ((i + 1) * ten <= mx) {
                        if (ten == 1)
                            ans++;
                        else
                            ans += tenPower[digits - 2];
                    }
                    else if (Long.compareUnsigned(i * ten + i, mx) <= 0) {
                        ans += 1 + (mx / 10 - i * ten / 10);
                        if (i > mx % 10) ans--;
                    }
                }

                ten *= 10;
                digits++;
            }
            return ans;
        }

        long[] power(int max) {
            long[] rs = new long[max + 1];
            rs[0] = 1;
            for (int i = 1; i <= max; ++i)
                rs[i] = rs[i - 1] * 10;
            return rs;
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            long l() {
                return in.nextLong();
            }

        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	static long[] pow10 = new long[18];

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		pow10[0] = 1;
		for(int i = 1; i < 18; ++i)
			pow10[i] = pow10[i - 1] * 10;
		long l = sc.nextLong(), r = sc.nextLong();
		out.println(count(Long.toString(r).toCharArray()) - count(Long.toString(l - 1).toCharArray()));
		out.flush();
		out.close();
	}

	static long count(char[] s)
	{
		if(s.length == 1)
			return s[0] - '0';
		long ans = 0;
		for(int i = s.length - 1; i > 0; --i)
		{
			int rem = Math.max(0, i - 2);
			ans += 9 * pow10[rem];
		}

		for(int i = 0; i < s.length - 1; ++i)
			if(i == 0)
				ans += (s[i] - '0' - 1) * pow10[s.length - 2 - i];
			else
				ans += (s[i] - '0') * pow10[s.length - 2 - i];

		if(s[0] <= s[s.length - 1])
			++ans;
		return ans;
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}
	}
}

import java.io.*;
import static java.lang.Math.*;
import static java.lang.Long.*;
@SuppressWarnings("unused")

public class round129C {

    public static long compute(long x){
        String s = ("" + x);
        int sz = s.length();
        int st = s.charAt(0) - '0';
        int ed = s.charAt(sz - 1) - '0';
        long ans = 0;
        for(int i = 1 ; i <= sz ; ++i){
            if(i == 1){
                for(int j = 1 ; j < 10 ; ++j)
                    if(j <= x)
                        ++ans;
            }else{
                if(i == 2){
                    for(int j = 1 ; j < 10 ; ++j){
                        if((j * 10 + j) <= x)
                            ++ans;
                    }
                }else{
                    int rem = i - 2;
                    if(i < sz){
                        for(int j = 1 ; j < 10 ; ++j){
                            ans += (long)pow(10, rem);
                        }
                    }else{
                        for(int j = 1 ; j < 10 ; ++j){
                            if(j > st)
                                break;
                            if(j < st)
                                ans += (long)pow(10, rem);
                            if(j == st){
                                for(int k = 1 ; k <= rem ; ++k){
                                    int cur = s.charAt(k) - '0';
                                    ans += (cur * (long)pow(10, rem - k));
                                }
                                if(j <= ed)
                                    ++ans;
                            }
                        }
                    }
                }
            }
        }
        return ans;
    }
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String [] use = br.readLine().split(" ");
        long start = parseLong(use[0]);
        long end = parseLong(use[1]);
        long upper = compute(end);
        long lower = compute(start);
        long ans = upper - lower;
        if(use[0].charAt(0) == use[0].charAt(use[0].length() - 1))
            ++ans;
        System.out.println(ans);
    }
}

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

/**
 *
 * @author Saju
 *
 */

public class Main {

    private static int dx[] = { 1, 0, -1, 0 };
    private static int dy[] = { 0, -1, 0, 1 };

    private static int dx1[] = { 1, 1, 0, -1, -1, -1, 0, 1 };
    private static int dy1[] = { 0, -1, -1, -1, 0, 1, 1, 1 };

    private static final long INF = (long) Math.pow(10, 16);
    private static final int INT_INF = Integer.MAX_VALUE;
    private static final long NEG_INF = Long.MIN_VALUE;
    private static final int NEG_INT_INF = Integer.MIN_VALUE;
    private static final double EPSILON = 1e-10;

    private static final long MAX = (long) 1e12;

    private static final long MOD = 1000000007;

    private static final int MAXN = 200001;
    private static final int MAXA = 1100000;
    private static final int MAXLOG = 22;
    private static final double PI = Math.acos(-1);

	public static void main(String[] args) throws IOException {

		InputReader in = new InputReader(System.in);
//		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

//         InputReader in = new InputReader(new FileInputStream("src/test.in"));
//         PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("src/test.out")));

/*

*/

		long l = in.nextLong();
		long r = in.nextLong();

		BigInteger ans = get(l, r);

		out.println(ans.toString());

		in.close();
		out.flush();
		out.close();
		System.exit(0);
	}

	private static BigInteger get(long l, long r) {

		String ls = String.valueOf(l);
		String rs = String.valueOf(r);

		int llen = ls.length();
		int rlen = rs.length();

		if(l == r) {
			if(ls.charAt(0) == ls.charAt(llen - 1) && rs.charAt(0) == rs.charAt(llen - 1) && ls.charAt(0) == rs.charAt(0)) {
				return BigInteger.ONE;
			}
			return BigInteger.ZERO;
		}

		BigInteger res = BigInteger.ZERO;
		for(int len = llen; len <= rlen; len++) {
			BigInteger val = calculate(l, r, ls, rs, len);

			res = res.add(val);
//			System.out.println(len + " " + val + " " + res);
		}
		return res;
	}

	private static BigInteger calculate(long l, long r, String ls, String rs, int len) {
		if(len == 1) {
			return BigInteger.valueOf(min(9L, r) - l + 1);
		}
		if(len == 2) {
			int c = 0;
			for(long lc = 11; lc <= 99; lc += 11) {
				if(lc >= l && lc <= r) {
					c++;
				}
			}
			return BigInteger.valueOf(c);
		}

		if(len == ls.length() && len != rs.length()) {
			BigInteger sum = BigInteger.ZERO;;
			int f = ls.charAt(0) - '0';
			int s = ls.charAt(len - 1) - '0';
//			System.out.println(f + " - " + s );
			BigInteger val2 = BigInteger.valueOf(10L).pow(len - 2);
			for(int i = f; i <= 9; i++) {

				if(i > f) {
					sum = sum.add(val2);
				}
				else {
					BigInteger sum1 = BigInteger.ZERO;
					String sub = ls.substring(1, len - 1);
					String ss = "";
					for(int j = 1; j < len - 1; j++) {
						ss += "9";
					}
					long v1 = Long.parseLong(ss);
					long v = v1 - Long.parseLong(sub);
//					System.out.println(ss + " - " + sub);
					if(f >= s) {
						v++;
					}
					sum1 = BigInteger.valueOf(v);
					sum = sum.add(sum1);
				}
			}

			return sum;
		}
		if(len == ls.length() && len == rs.length()) {

			BigInteger sum = BigInteger.ZERO;;
			int f1 = ls.charAt(0) - '0';
			int s1 = ls.charAt(len - 1) - '0';
			int f2 = rs.charAt(0) - '0';
			int s2 = rs.charAt(len - 1) - '0';
//			System.out.println(f + " - " + s );
			BigInteger val2 = BigInteger.valueOf(10L).pow(len - 2);
			for(int i = f1; i <= f2; i++) {
//				System.out.println(i + " " + sum);
				if(i > f1 && i < f2) {
					sum = sum.add(val2);
				}
				else if(i == f1 && i != f2) {
					BigInteger sum1 = BigInteger.ZERO;
					String sub = ls.substring(1, len - 1);
					String ss = "";
					for(int j = 1; j < len - 1; j++) {
						ss += "9";
					}
					long v1 = Long.parseLong(ss);
					long v2 = Long.parseLong(sub);
					long v = v1 - v2;
//					System.out.println(ss + " - " + sub);
//					System.out.println(v1 + "  " + v2 + " " + v);
					if(f1 >= s1) {
						v++;
					}
					sum1 = BigInteger.valueOf(v);
					sum = sum.add(sum1);
				}
				else if(i != f1 && i == f2) {
					BigInteger sum1 = BigInteger.ZERO;
					String sub = rs.substring(1, len - 1);
					long v = Long.parseLong(sub);
					if(s2 >= f2) {
						v++;
					}
					sum1 = BigInteger.valueOf(v);
					sum = sum.add(sum1);
				}
				else if(i == f1 && i == f2) {
					String sub1 = ls.substring(1, len - 1);
					String sub2 = rs.substring(1, len - 1);
					long v1 = Long.valueOf(sub1);
					long v2 = Long.valueOf(sub2);
					long v = abs(v2 - v1);
					if(f1 >= s1 && s2 >= f2 ) {
						v++;
					}
					BigInteger sum1 = BigInteger.valueOf(v);
					sum = sum.add(sum1);
				}

			}

			return sum;
		}

		if(len != rs.length()) {
			BigInteger val1 = BigInteger.valueOf(9L);
			BigInteger val2 = BigInteger.valueOf(10L).pow(len - 2);
			return val1.multiply(val2);
		}
		BigInteger sum = BigInteger.ZERO;;
		int f = rs.charAt(0) - '0';
		int s = rs.charAt(len - 1) - '0';
//		System.out.println(f + " - " + s );
		BigInteger val2 = BigInteger.valueOf(10L).pow(len - 2);
		for(int i = 1; i <= f; i++) {

			if(i < f) {
				sum = sum.add(val2);
			}
			else {
				BigInteger sum1 = BigInteger.ZERO;
				String sub = rs.substring(1, len - 1);
				long v = Long.parseLong(sub);
				if(s >= f) {
					v++;
				}
				sum1 = BigInteger.valueOf(v);
				sum = sum.add(sum1);
			}
		}

		return sum;
	}

	/*
	 * return the number of elements in list that are less than or equal to the val
	 */
	private static long upperBound(List<Long> list, long val) {
		int start = 0;
		int len = list.size();
		int end = len - 1;
		int mid = 0;

		while (true) {
			if (start > end) {
				break;
			}
			mid = (start + end) / 2;
			long v = list.get(mid);
			if (v == val) {
				start = mid;
				while(start < end) {
					mid = (start + end) / 2;
					if(list.get(mid) == val) {
						if(mid + 1 < len && list.get(mid + 1) == val) {
							start = mid + 1;
						}
						else {
							return mid + 1;
						}
					}
					else {
						end = mid - 1;
					}
				}
				return start + 1;
			}
			if (v > val) {
				end = mid - 1;
			} else {
				start = mid + 1;
			}
		}
		if (list.get(mid) < val) {
			return mid + 1;
		}
		return mid;
	}

	private static boolean isPalindrome(String str) {
		StringBuilder sb = new StringBuilder();
		sb.append(str);
		String str1 = sb.reverse().toString();
		return str.equals(str1);
	}

	private static String getBinaryStr(long n, int j) {
		String str = Long.toBinaryString(n);
		int k = str.length();
		for (int i = 1; i <= j - k; i++) {
			str = "0" + str;
		}

		return str;
	}

	private static long modInverse(long r) {
		return bigMod(r, MOD - 2, MOD);
	}

	private static long bigMod(long n, long k, long m) {

        long ans = 1;
        while (k > 0) {
            if ((k & 1) == 1) {
                ans = (ans * n) % m;
            }
            n = (n * n) % m;
            k >>= 1;
        }
        return ans;
    }

	private static long ceil(long n, long x) {
		long div = n / x;
        if(div * x != n) {
            div++;
        }
        return div;
	}

    private static int ceil(int n, int x) {
        int div = n / x;
        if(div * x != n) {
            div++;
        }
        return div;
    }

    private static int abs(int x) {
        if (x < 0) {
            return -x;
        }
        return x;
    }

    private static double abs(double x) {
        if (x < 0) {
            return -x;
        }
        return x;
    }

    private static long abs(long x) {
        if(x < 0) {
            return -x;
        }
        return x;
    }

    private static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    private static int lcm(int a, int b) {
        return (a * b) / gcd(a, b);
    }

    private static int gcd(int a, int b) {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    private static long gcd(long a, long b) {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    private static int log(long x, int base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    private static int log(long x, long base) {
        return (int) (Math.log(x) / Math.log(base));
    }

    private static long min(long a, long b) {
        if (a < b) {
            return a;
        }
        return b;
    }

    private static int min(int a, int b) {
        if (a < b) {
            return a;
        }
        return b;
    }

    private static long max(long a, long b) {
        if (a < b) {
            return b;
        }
        return a;
    }

    private static int max(int a, int b) {
        if (a < b) {
            return b;
        }
        return a;
    }

    private static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());

                }
            } catch (IOException e) {
                return null;
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            String line = null;
            try {
                tokenizer = null;
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

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

        public boolean hasNext() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (Exception e) {
                return false;
            }
            return true;
        }

        public int[] nextIntArr(int n) {
        	int arr[] = new int[n];
    		for(int i = 0; i < n; i++) {
    			arr[i] = nextInt();
    		}
    		return arr;
        }

        public long[] nextLongArr(int n) {
        	long arr[] = new long[n];
    		for(int i = 0; i < n; i++) {
    			arr[i] = nextLong();
    		}
    		return arr;
        }

        public int[] nextIntArr1(int n) {
        	int arr[] = new int[n + 1];
    		for(int i = 1; i <= n; i++) {
    			arr[i] = nextInt();
    		}
    		return arr;
        }

        public long[] nextLongArr1(int n) {
        	long arr[] = new long[n + 1];
    		for(int i = 1; i <= n; i++) {
    			arr[i] = nextLong();
    		}
    		return arr;
        }

        public void close() {
        	try {
        		if(reader != null) {
        			reader.close();
        		}
        	}
        	catch(Exception e) {

        	}

        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {
	public static long f(String s, long n){
		if(n < 10)
			return n;
		if(s.charAt(0) <= s.charAt(s.length()-1))
			return n/10+9;
		return n/10+8;
	}
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long ll = sc.nextLong(), rr = sc.nextLong();
		out.println(f(""+rr, rr)-f(ll-1+"", ll-1));
		out.flush();
		out.close();
	}

	static class Scanner {
		BufferedReader bf;
		StringTokenizer st;

		public Scanner(InputStream i) {
			bf = new BufferedReader(new InputStreamReader(i));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(bf.readLine());
			return st.nextToken();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
	}
}

import java.util.Scanner;

public class LittleElephantAndInterval {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long r = sc.nextLong();
		long l = sc.nextLong();
		sc.close();
		System.out.println(solve(l) - solve(r - 1));
	}

	public static long solve(long x)
	{
		if(x < 10)
			return x;
		String s = x + "";
		if(s.charAt(0) <= s.charAt(s.length() - 1))
			return x/10 + 9;
		return x / 10 + 8;
	}
}

import java.io.*;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.lang.Long.*;
@SuppressWarnings("unused")

public class round129C {

    final static BigInteger one = BigInteger.ONE;
    final static BigInteger ten = BigInteger.TEN;
    public static BigInteger compute(long x){
        String s = ("" + x);
        int sz = s.length();
        int st = s.charAt(0) - '0';
        int ed = s.charAt(sz - 1) - '0';
        BigInteger ans = BigInteger.ZERO;
        for(int i = 1 ; i <= sz ; ++i){
            if(i == 1){
                for(int j = 1 ; j < 10 ; ++j)
                    if(j <= x)
                        ans = ans.add(one);
            }else{
                if(i == 2){
                    for(int j = 1 ; j < 10 ; ++j){
                        if((j * 10 + j) <= x)
                            ans = ans.add(one);
                    }
                }else{
                    int rem = i - 2;
                    if(i < sz){
                        for(int j = 1 ; j < 10 ; ++j){
                            ans = ans.add(ten.pow(rem));
                        }
                    }else{
                        for(int j = 1 ; j < 10 ; ++j){
                            if(j > st)
                                break;
                            if(j < st)
                                ans = ans.add(ten.pow(rem));
                            if(j == st){
                                for(int k = 1 ; k <= rem ; ++k){
                                    int cur = s.charAt(k) - '0';
                                    ans =ans.add(new BigInteger(""+cur).multiply(ten.pow(rem - k)));
                                }
                                if(j <= ed)
                                    ans = ans.add(one);
                            }
                        }
                    }
                }
            }
        }
        return ans;
    }
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String [] use = br.readLine().split(" ");
        long start = parseLong(use[0]);
        long end = parseLong(use[1]);
        BigInteger upper = compute(end);
        BigInteger lower = compute(start);
        BigInteger ans = upper.subtract(lower);
        if(use[0].charAt(0) == use[0].charAt(use[0].length() - 1))
            ans = ans.add(one);
        System.out.println(ans.toString());
    }
}

import java.io.*;
import java.util.*;
public class Solution
{
    static long dp[][][][];
    public static void main(String ag[])
    {
        Scanner sc=new Scanner(System.in);
        int i,j,k,l;
        long L=sc.nextLong();
        long R=sc.nextLong();

        ArrayList<Integer> num1=number(L-1);
        ArrayList<Integer> num2=number(R);

        fill();
        long upto_L=find(0,0,0,0,num1);
        fill();
        long upto_R=find(0,0,0,0,num2);

        System.out.println(upto_R-upto_L);
    }
    public static long find(int pos,int tight,int firstDigit,int lastDigit,ArrayList<Integer> num)
    {
        if(pos==num.size())
        {
            if(firstDigit==lastDigit)
            return 1;
            return 0;
        }

        if(dp[pos][tight][firstDigit][lastDigit]!=-1)
        return dp[pos][tight][firstDigit][lastDigit];

        int limit;
        if(tight==0)
        limit=num.get(pos);
        else
        limit=9;

        long total=0;
        for(int i=0;i<=limit;i++)
        {
            int newTight=tight;
            if(i<limit)
            newTight=1;

            int first_D=firstDigit;
            if(firstDigit==0)
            first_D=i;
            total+=find(pos+1,newTight,first_D,i,num);
        }
        return dp[pos][tight][firstDigit][lastDigit]=total;
    }
    public static ArrayList<Integer> number(long N)
    {
        ArrayList<Integer> al=new ArrayList<>();
        while(N>0)
        {
            al.add((int)(N%10));
            N/=10;
        }
        Collections.reverse(al);
        return al;
    }
    public static void fill()
    {
        int i,j,k,l;
        dp=new long[20][2][10][10];
        for(i=0;i<20;i++)
        for(j=0;j<2;j++)
        for(k=0;k<10;k++)
        for(l=0;l<10;l++)
        dp[i][j][k][l]=-1;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;

public class Solution
{
   public static long ans(Long num,int l,long[] arr){
       if(num<10)
       return num;
        String n=num+"";
         l=n.length();
       long ans=0;
     for(int i=1 ;i<l;i++){
         ans=ans+arr[i];
        // System.out.println(ans+"*"+i);
     }
      //System.out.println(ans+"*");

     if(n.charAt(0)>=n.charAt(l-1)){

         int k=n.charAt(0)-'0';
         if(l==2 && n.charAt(0)==n.charAt(l-1)){
             return ans+k;
         }
         ans=ans+(long)((k-1)*Math.pow(10,l-2));
         if(l!=2){
         ans=ans+Long.parseLong(n.substring(1,l-1))+1;
         if(n.charAt(0)>n.charAt(l-1))
         ans--;
         }
         return ans;

     }else if(n.charAt(0)<n.charAt(l-1)){
         int k=n.charAt(0)-'0';

         if(l!=2){
         ans=ans+(long)((k-1)*Math.pow(10,l-2));
          ans=ans+Long.parseLong(n.substring(1,l-1))+1;
         }else{
             return ans+k;
         }
         return ans;
     }
  return 0;
   }

    public static void main(String[] args) throws IOException
    {

       BufferedReader br = new BufferedReader(
                              new InputStreamReader(System.in));

         StringTokenizer s=new StringTokenizer(br.readLine());
        String o=s.nextToken();
        String t=s.nextToken();
        long arr[]=new long[19];

        arr[1]=9;
        long k=9;
        for(int i=2;i<19;i++){
            arr[i]=k;
            k=k*10;
        }
        // for(int i=0;i<19;i++){
        //     System.out.println(arr[i]+"*");
        // }
        Long num1=Long.parseLong(o);
        Long num2=Long.parseLong(t);

       long a1=ans(num2,t.length(),arr);
        long a2=ans(num1-1,o.length(),arr);
       // System.out.println(a1);
      //  System.out.println(a2);
         System.out.println(a1-a2);

}}
 class TreeNode{
    int val;
    ArrayList<TreeNode> child;
    public TreeNode(int x){
        val=x;
        child=new ArrayList<>();
    }

 }
// class Sort implements Comparator<act>
// {
//     // Used for sorting in ascending order of
//     // roll number
//     public int compare(act a, act b)
//     {
//         if(a.p==b.p)
//         return a.c - b.c;
//         else
//         //decsending order
//         return b.p-a.p;
//     }
// }
//  class SortT implements Comparator<table>
// {
//     // Used for sorting in ascending order of
//     // roll number
//     public int compare(table a, table b)
//     {

//         //acsending order
//         return a.n-b.n;
//     }
// }

import java.util.*;
import java.io.*;

public class TaskC implements Runnable {
	BufferedReader in;
	PrintWriter out;
	StringTokenizer stok;

	String nextToken() {
		while (stok == null || !stok.hasMoreTokens()) {
			try {
				stok = new StringTokenizer(in.readLine());
			} catch (Exception e) {
				return null;
			}
		}
		return stok.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	int len(long x) {
		int res = 0;
		while (x > 0) {
			x /= 10;
			res++;
		}
		return res;
	}

	boolean check(long x) {
		int f = (int) (x % 10);
		while (x / 10 > 0) {
			x /= 10;
		}
		return f == x;
	}

	long center(long x) {
		return x / 10 % p10[len(x) - 2];
	}

	long[] p10;

	void solve() {
		p10 = new long[19];
		p10[0] = 1;
		for (int i = 1; i < 19; i++) {
			p10[i] = p10[i - 1] * 10;
		}
		long l = nextLong(), r = nextLong();
		long ans = 0;
		while (l <= r && l <= 100) {
			if (check(l)) {
				ans++;
			}
			l++;
		}
		while (!check(l)) {
			l++;
		}
		while (!check(r)) {
			r--;
		}
		if (l > r) {
			out.println(ans);
			return;
		}
		int lenl = len(l), lenr = len(r);
		if (lenl == lenr) {
			ans += center(r) - center(l) + 1 + p10[lenl - 2] * (r % 10 - l % 10);
		} else {
			ans += p10[lenl - 2] - center(l) + center(r) + 1;
			l += (p10[lenl - 2] - center(l)) * 10;
			l -= l % 10;
			while (!check(l)) {
				l++;
			}
			r -= center(r) * 10;
			for (int i = 1; i <= 16; i++) {
				for (int g = 1; g <= 9; g++) {
					long v = g * p10[i + 1] + g;
					if (v >= l && v < r) {
						ans += p10[i];
					}
				}
			}
		}
		out.println(ans);
	}

	public void run() {
		try {
			try {
				in = new BufferedReader(new FileReader("taskc.in"));
				out = new PrintWriter("taskc.out");
			} catch (Exception e1) {
				try {
					in = new BufferedReader(new FileReader("input.txt"));
					out = new PrintWriter("output.txt");
				} catch (Exception e2) {
					in = new BufferedReader(new InputStreamReader(System.in));
					out = new PrintWriter(System.out);
				}
			}
			solve();
			in.close();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new Thread(new TaskC()).run();
	}
}//xosrus

import java.util.Scanner;

public class CF205C_LittleElephantandInterval {

	public static long lower(long r) {
		if (r < 10)
			return r;
		String hi = r + "";
		if (hi.charAt(hi.length() - 1) >= hi.charAt(0))
			return r / 10 + 9;
		else
			return r / 10 + 8;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		System.out.println(Math.max(lower(r) - lower(l - 1), 0));

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) throws Exception{

		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		out.println(-solve(sc.nextLong()-1) + solve(sc.nextLong()));
		out.flush();
	}

	static long solve(long x)
	{
		if(x < 10)
			return x;
		char[] a = Long.toString(x).toCharArray();
		return 8 + x/10 + (a[0] <= a[a.length-1]? 1 : 0);
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream System){br = new BufferedReader(new InputStreamReader(System));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine()throws IOException{return br.readLine();}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar()throws IOException{return next().charAt(0);}
		public Long nextLong()throws IOException{return Long.parseLong(next());}
		public boolean ready() throws IOException{return br.ready();}
		public void waitForInput(){for(long i = 0; i < 3e9; i++);}
	}
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class LittleElephantAndInterval implements Closeable {

  private InputReader in = new InputReader(System.in);
  private PrintWriter out = new PrintWriter(System.out);

  public void solve() {
    long left = in.nl(), right = in.nl();
    out.println(f(right) - f(left - 1));
  }

  private long f(long x) {
    if (x < 10) return x;
    long k = x / 10, e = x % 10, f = 10;
    while (x > 0) {
      f = x % 10;
      x /= 10;
    }
    return f <= e ? k + 9 : k + 8;
  }

  @Override
  public void close() throws IOException {
    in.close();
    out.close();
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

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

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

    public void close() throws IOException {
      reader.close();
    }
  }

  public static void main(String[] args) throws IOException {
    try (LittleElephantAndInterval instance = new LittleElephantAndInterval()) {
      instance.solve();
    }
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	static long l,r;
	static long bs(long between,long bound,long max)
	{
		if(max<=100)return 0;
		long hi = 0;
		for (int i = 0; i < between; i++)
			hi+= 9 * pow(10,i);
		long lo = 0 , ans = -1;
		while(lo<=hi)
		{
			long mid = lo + (hi-lo) / 2l;
			long cur = f(bound,mid,between+1);
			if(cur<=max)
				ans = Math.max(ans, mid);
			if(cur>max)
				hi = mid-1;
			else if(cur<max)
				lo = mid+1;
			else if(cur==max)
				break;
		}
		return ans+1;
	}
	static long f(long bound,long mid,long pos)
	{
		mid *= 10;
		return mid + bound + (bound*pow(10,pos));
	}
	static long pow(long a,long b)
	{
		long ans = 1;
		while(b-->0)ans*=1l * a;
		return ans;
	}
	public static void main(String[] args) throws Throwable {
		Scanner sc = new Scanner((System.in));
		l = sc.nextLong()-1;
		r = sc.nextLong();
		long ans = 0;
		long a = 0 , b = 0;
		for (int i = 0; i < 10; i++)
		{
			if(i<=l)a++;
			if(i<=r)b++;
		}
		for (int i = 1; i < 10; i++)
		{
			if(i*10+i<=l)a++;
			if(i*10+i<=r)b++;
		}

		for (int between = 1; between < 17; between++)
		{
			for(int bound = 1;bound<10;bound++)
			{
				a += 1l*bs(between, bound, l);
				b += 1l*bs(between,bound, r);
			}
		}
		ans += b-a;
		System.out.println(ans);
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

		public String nextLine() throws IOException {return br.readLine();}

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

		public boolean ready() throws IOException {return br.ready();}

	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class LittleElephantAndInterval {

	static long calc(long x) {
		if (x < 10)
			return x;
		String a = Long.toString(x);
		if (a.charAt(0) <= a.charAt(a.length() - 1))
			return x / 10 + 9;
		return x / 10 + 8;
	}

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		out.println(-calc(sc.nextLong() - 1) + calc(sc.nextLong()));
		out.flush();
		out.close();
	}

	static class MyScanner {

		BufferedReader br;
		StringTokenizer st;

		MyScanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		MyScanner(String filename) throws IOException {
			br = new BufferedReader(new FileReader(new File(filename)));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		boolean ready() throws IOException {
			return br.ready();
		}
	}
}

import java.util.Scanner;

public class main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
         Scanner in = new Scanner(System.in);
         long l=in.nextLong();
         long r=in.nextLong();
         String s=Long.toString(r);

         long x;
         if(r<10)x=r;
         else
         {

             while(s.charAt(0)!=s.charAt(s.length()-1))
          {   s=Long.toString(r);
              r--;
              s=Long.toString(r);

          }

           x=r/10+9;

         }
         long y=0;
         if(l<10)y=l-1;
         else
         {   s=Long.toString(l);
             if(s.charAt(0)==s.charAt(s.length()-1))y=-1;
             while(s.charAt(0)!=s.charAt(s.length()-1))
             {
                 l--;
                 s=Long.toString(l);

             }

                   y=y+l/10+9;

         }
        System.out.println(x-y);
    }

}

import java.util.Scanner;

public class C {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while (scan.hasNext()) {
			long l = scan.nextLong();
			long r = scan.nextLong();
//			habal(l, r);

			if (l % 10 == 0 && r % 10 == 0) {
				// sa7
				System.out.println(((r - l) / 10));
			} else if (l % 10 != 0 && r % 10 == 0) {
				// done;
				long temp = l;
				long tens = 0;
				while (true) {
					if (check(temp))
						tens++;
					temp++;
					if (temp % 10 == 0)
						break;

				}
				System.out.println(tens + ((r - temp) / 10));
			} else if (l % 10 == 0 && r % 10 != 0) {
				long temp = r;
				long tens = 0;
				while (true) {
					if (check(temp))
						tens++;
					temp--;
					if (temp % 10 == 0)
						break;
				}
				System.out.println(tens + ((temp - l) / 10));
			} else {
				if (l / 10 == r / 10) {
					int count = 0;
					while (l <= r) {
						if (check(l))
							count++;
						l++;
					}
					System.out.println(count);
				} else {

					long temp = l;
					long tens = 0;
					while (true) {
						if (check(temp))
							tens++;
						temp++;
						if (temp % 10 == 0)
							break;

					}

					long temp2 = r;
					long tens2 = 0;
					while (true) {
						if (check(temp2))
							tens2++;
						temp2--;
						if (temp2 % 10 == 0)
							break;
					}
					System.out.println(tens + tens2 + ((temp2 - temp) / 10));
				}
			}
		}
	}

	public static void habal(long l, long r) {
		int check = 0;
		while (l <= r) {
			if (check(l))
				check++;
			l++;
		}
		System.out.println(check);
	}

	public static boolean check(long x) {
		String s = x + "";
		return (s.charAt(0) == s.charAt(s.length() - 1)) || s.length() == 1;
	}
}

import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
public class B {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long a=sc.nextLong();
        long b=sc.nextLong();
        long ans=b/10-a/10+1;
        String s1=""+a;
        String s2=""+b;
        if(s1.charAt(0)<s1.charAt(s1.length()-1)) ans--;
        if(s2.charAt(0)>s2.charAt(s2.length()-1)) ans--;
        if(a<10) ans+=9-a;
        if(b<10) ans-=9-b;
        System.out.println(ans);
    }
}

import java.io.*;
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class cf204a {

    public static void main(String[] args) throws IOException {
        long l = rnl(), r = nl();
        prln(get(r) - get(l - 1));
        // prln(get(2000));
        /* for(int i = 1; i < 100; ++i) {
            prln(i, get(i));
        } */
        /* for(int i = 95; i < 1000; ++i) {
            pr(i);
            pr(' ');
            get(i);
        } */
        close();
    }

    static long get(long x) {
        if(x <= 9) {
            return min(9, x);
        } else if(x <= 99) {
            return 9 + x / 11;
        } else {
            long buf = x, first = 0, ans = 9, mult = 1;
            int cnt = 0;
            while(buf > 0) {
                first = buf % 10;
                buf /= 10;
                ++cnt;
            }
            if(x % 10 < first) {
                x -= 10;
            }
            for(int i = 1; i < cnt - 1; ++i) {
                ans += 9 * mult;
                mult *= 10;
            }
            // mult *= 10;
            ans += x / 10 - mult + 1;
            // prln(x, first, (x - first * mult) / 10);
            return ans;
        }
    }

    static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out));
    static StringTokenizer input;
    static Random rand = new Random();

    // references
    // IBIG = 1e9 + 7
    // IRAND ~= 3e8
    // IMAX ~= 2e10
    // LMAX ~= 9e18
    // constants
    static final int IBIG = 1000000007;
    static final int IRAND = 327859546;
    static final int IMAX = 2147483647;
    static final int IMIN = -2147483648;
    static final long LMAX = 9223372036854775807L;
    static final long LMIN = -9223372036854775808L;
    // util
    static int minof(int a, int b, int c) {return min(a, min(b, c));}
    static int minof(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); int min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static long minof(long a, long b, long c) {return min(a, min(b, c));}
    static long minof(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return min(x[0], x[1]); if(x.length == 3) return min(x[0], min(x[1], x[2])); long min = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] < min) min = x[i]; return min;}
    static int maxof(int a, int b, int c) {return max(a, max(b, c));}
    static int maxof(int... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); int max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static long maxof(long a, long b, long c) {return max(a, max(b, c));}
    static long maxof(long... x) {if(x.length == 1) return x[0]; if(x.length == 2) return max(x[0], x[1]); if(x.length == 3) return max(x[0], max(x[1], x[2])); long max = x[0]; for(int i = 1; i < x.length; ++i) if(x[i] > max) max = x[i]; return max;}
    static int powi(int a, int b) {if(a == 0) return 0; int ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static long powl(long a, int b) {if(a == 0) return 0; long ans = 1; while(b > 0) {if((b & 1) > 0) ans *= a; a *= a; b >>= 1;} return ans;}
    static int floori(double d) {return (int)d;}
    static int ceili(double d) {return (int)ceil(d);}
    static long floorl(double d) {return (long)d;}
    static long ceill(double d) {return (long)ceil(d);}
    static void shuffle(int[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); int swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(long[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); long swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void shuffle(double[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); double swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static <T> void shuffle(T[] a) {int n = a.length - 1; for(int i = 0; i < n; ++i) {int ind = randInt(i, n); T swap = a[i]; a[i] = a[ind]; a[ind] = swap;}}
    static void rsort(int[] a) {shuffle(a); sort(a);}
    static void rsort(long[] a) {shuffle(a); sort(a);}
    static void rsort(double[] a) {shuffle(a); sort(a);}
    static int randInt(int min, int max) {return rand.nextInt(max - min + 1) + min;}
    // input
    static void r() throws IOException {input = new StringTokenizer(__in.readLine());}
    static int ri() throws IOException {return Integer.parseInt(__in.readLine());}
    static long rl() throws IOException {return Long.parseLong(__in.readLine());}
    static int[] ria(int n) throws IOException {int[] a = new int[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Integer.parseInt(input.nextToken()); return a;}
    static long[] rla(int n) throws IOException {long[] a = new long[n]; input = new StringTokenizer(__in.readLine()); for(int i = 0; i < n; ++i) a[i] = Long.parseLong(input.nextToken()); return a;}
    static char[] rcha() throws IOException {return __in.readLine().toCharArray();}
    static String rline() throws IOException {return __in.readLine();}
    static int rni() throws IOException {input = new StringTokenizer(__in.readLine()); return Integer.parseInt(input.nextToken());}
    static int ni() {return Integer.parseInt(input.nextToken());}
    static long rnl() throws IOException {input = new StringTokenizer(__in.readLine()); return Long.parseLong(input.nextToken());}
    static long nl() {return Long.parseLong(input.nextToken());}
    // output
    static void pr(int i) {__out.print(i);}
    static void prln(int i) {__out.println(i);}
    static void pr(long l) {__out.print(l);}
    static void prln(long l) {__out.println(l);}
    static void pr(double d) {__out.print(d);}
    static void prln(double d) {__out.println(d);}
    static void pr(char c) {__out.print(c);}
    static void prln(char c) {__out.println(c);}
    static void pr(char[] s) {__out.print(new String(s));}
    static void prln(char[] s) {__out.println(new String(s));}
    static void pr(String s) {__out.print(s);}
    static void prln(String s) {__out.println(s);}
    static void pr(Object o) {__out.print(o);}
    static void prln(Object o) {__out.println(o);}
    static void prln() {__out.println();}
    static void pryes() {__out.println("yes");}
    static void pry() {__out.println("Yes");}
    static void prY() {__out.println("YES");}
    static void prno() {__out.println("no");}
    static void prn() {__out.println("No");}
    static void prN() {__out.println("NO");}
    static void pryesno(boolean b) {__out.println(b ? "yes" : "no");};
    static void pryn(boolean b) {__out.println(b ? "Yes" : "No");}
    static void prYN(boolean b) {__out.println(b ? "YES" : "NO");}
    static void prln(int... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static void prln(long... a) {for(int i = 0, len = a.length - 1; i < len; __out.print(a[i]), __out.print(' '), ++i); __out.println(a[a.length - 1]);}
    static <T> void prln(Collection<T> c) {int n = c.size() - 1; Iterator<T> iter = c.iterator(); for(int i = 0; i < n; __out.print(iter.next()), __out.print(' '), ++i); if(n >= 0) __out.println(iter.next());}
    static void h() {__out.println("hlfd");}
    static void flush() {__out.flush();}
    static void close() {__out.close();}
}

//package Round_129;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;

import static java.lang.Math.*;

public class c implements Runnable {

    String input = "";
    String output = "";
    BufferedReader bf;
    FastScanner in;
    PrintWriter out;

    long f (long n){
        if (n < 10)
            return n;
        String s = Long.toString(n);
        return (n / 10 - 1) + (s.charAt(0) <= s.charAt(s.length()-1) ? 1 : 0) + 9;
    }

    public void solve() throws Exception {
        long l = in.nextLong();
        long r = in.nextLong();
        out.println(f(r) - f(l - 1));
    }

    @Override
    public void run() {
        try {
            if (input.equals("")) {
                bf = new BufferedReader(new InputStreamReader(System.in));
            } else {
                bf = new BufferedReader(new FileReader(input));
            }

            in = new FastScanner(bf);

            if (output.equals("")) {
                out = new PrintWriter(System.out);
            } else {
                out = new PrintWriter(new File(output));
            }

            solve();

            out.flush();

        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) {
        new Thread(null, new c(), "1", 1 << 23).start();
    }

    class FastScanner {

        BufferedReader bf;
        StringTokenizer st;

        public FastScanner(BufferedReader bf) {
            this.bf = bf;
        }

        public String next() throws Exception {

            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(bf.readLine());
            }

            return st.nextToken();
        }

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

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

        public double nextDouble() throws Exception {
            return Double.parseDouble(next());
        }
    }
}

import java.util.*;

public class Problem204A {

	public static long CalculateSymetrical(long limit) {
		if(limit < 10) {
			return limit;
		}
		long modulus = limit % 10;
		long numbers = (limit / 10) + 9;
		while(limit >= 10) limit /= 10;
		if(limit > modulus) numbers--;
		return numbers;

	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long lowerLimit = sc.nextLong();
		long upperLimit = sc.nextLong();

		System.out.println(CalculateSymetrical(upperLimit) - CalculateSymetrical(lowerLimit - 1));

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Test {
	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

	static int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	static String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		tokenizer = null;
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}

	static long cnt(long l) {
		if (l == 0) {
			return 0;
		}
		if (1 <= l && l <= 9) {
			return l;
		}
		long first = l;
		while (first >= 10)
			first /= 10;
		long last = l % 10;

		if (first != last) {
			while (first != last) {
				l--;
				first = l;
				while (first >= 10)
					first /= 10;
				last = l % 10;
			}
			return cnt(l);
		}
		//System.err.println(l);
		int len=0;
		long curr=l;
		while(curr!=0)
		{
			len++;
			curr/=10;
		}
		//System.err.println(len);
		long bz = (long) Math.pow(10, len-1);
		//System.err.println(bz);
		long tmp = l%bz;
		tmp/=10;
		tmp++;
		//System.err.println("1 "+tmp);
		long beg = l/bz;
		for(long i=beg-1;i>0;i--)
		{
			tmp+=cntnice(len);
		}
		//System.err.println("2 "+tmp);
		for(int i=len-1;i>=2;i--)
		{
			tmp+=9*cntnice(i);
		}
		//System.err.println("3 "+tmp);
		return tmp+9;
	}

	static long cntnice(int len)
	{
		return (long)Math.pow(10, len-2);
	}

	private static void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		writer.println (cnt(r)-cnt(l-1));
	}
}

import static java.util.Arrays.deepToString;

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

public class A {

	static long get(long R, int d) {
		long ret = 1;
		String w = R + "";
		long p10 = 1;
		for (int len = 1; len < w.length(); len++) {
			ret += p10;
			p10 *= 10;
		}
		if (w.charAt(0) - '0' == d)
			ret += R % p10 + 1;
		if (w.charAt(0) - '0' > d)
			ret += p10;
		return ret;
	}

	static long get(long R) {
		long ret = 0;
		for (int d = 1; d <= Math.min(R, 9); d++) {
			ret += get((R - d) / 10, d);
		}
		return ret;
	}

	static long brute(long L, long R) {
		long ret = 0;
		for (long x = L; x <= R; x++) {
			String w = x + "";
			if (w.charAt(0) == w.charAt(w.length() - 1))
				ret++;
		}
		return ret;
	}

	static void check() {
		for (int L = 1; L <= 1000; L++) {
			for (int R = L; R <= 1000; R++) {
				if (get(R) - get(L - 1) != brute(L, R)) {
					debug(L, R, brute(L, R), get(R));
					throw new AssertionError();
				}
			}
		}
	}

	static void solve() {
		long L = nextLong(), R = nextLong();
		writer.println(get(R) - get(L - 1));
	}

	public static void main(String[] args) throws Exception {
		reader = new BufferedReader(new InputStreamReader(System.in));
		writer = new PrintWriter(System.out);

		// check();
		setTime();
		solve();
		printTime();
		printMemory();

		writer.close();
	}

	static BufferedReader reader;
	static PrintWriter writer;
	static StringTokenizer tok = new StringTokenizer("");
	static long systemTime;

	static void debug(Object... o) {
		System.err.println(deepToString(o));
	}

	static void setTime() {
		systemTime = System.currentTimeMillis();
	}

	static void printTime() {
		System.err.println("Time consumed: " + (System.currentTimeMillis() - systemTime));
	}

	static void printMemory() {
		System.err.println("Memory consumed: " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000 + "kb");
	}

	static String next() {
		while (!tok.hasMoreTokens()) {
			String w = null;
			try {
				w = reader.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			if (w == null)
				return null;
			tok = new StringTokenizer(w);
		}
		return tok.nextToken();
	}

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

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

	static double nextDouble() {
		return Double.parseDouble(next());
	}

	static BigInteger nextBigInteger() {
		return new BigInteger(next());
	}
}

import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        long l=nl();
        long r=nl();
        if(r-l<100)
        {
            long ans=0;
            for(long i=l;i<=r;i++)
                if(firstDig(i)==i%10)
                    ans++;
            pn(ans);return;
        }
        long ans=0;
        if(l<10)
            {ans+=(10-l);l=10;}
        // pn(ans);
        if(firstDig(l)>=l%10 && l%10!=0)
        {
            ans++;
            l+=(10-(l%10));
        }
        if(firstDig(r)<=r%10 && r%10!=0)
        {
            ans++;
            r-=(r%10);
        }
        ans+=(r-l)/10;
        pn(ans);

    }
    static int firstDig(long a)
    {
        String s=Long.toString(a);
        return s.charAt(0)-48;
    }
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = System.getProperty("ONLINE_JUDGE") != null;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.util.*;
import static java.lang.Math.*;
public class ProblemC {
    void run() {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        p("%s\n", countNumbers(r) - countNumbers(l-1));

    }

    long countNumbers(long bound) {
      long total = 0;
      if (bound < 0) {
        return 0;
      } else if (bound <= 100) {
        for (int i=1; i<=bound; i++) {
          String s = Integer.toString(i);
          if (s.charAt(0) == s.charAt(s.length()-1)) {
            total += 1;
          }
        }
        return total;
      }

      String s = Long.toString(bound);
      int len = s.length();

      total += countAllDigits(len);

      int firstDigit = Integer.parseInt(s.substring(0, 1), 10);
      int lastDigit = Integer.parseInt(s.substring(len-1, len), 10);

    total += (firstDigit - 1) * Math.pow(10, len - 2);

      long middle = Long.parseLong(s.substring(1, len-1), 10);
      d("Middle is %s", middle);
      if (firstDigit <= lastDigit) {
        total += middle + 1;
      } else {
        total += middle;
      }

      return total;
    }

    long countAllDigits(int len) {

      long total = 0;
      for (int i=1; i<len; i++) {
        total += (long) (9L * Math.pow(10L, Long.valueOf(Math.max(i-2, 0))));
      }
      d("Count all digits for length=%s, out=%s", len, total);
      return total;
    }

    boolean debug = false;
    void p(String f, Object...params) {
        System.out.printf(f, params);
    }
    void d(Object...params) {
        if (debug) {
            p("DEBUG: %s\n", Arrays.deepToString(params));
        }
    }
    public ProblemC(String[] args) {
        if (args.length > 0 && args[0].equals("debug")) {
            debug = true;
        }
    }
    public static void main(String[] args) {
        new ProblemC(args).run();
    }
}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
        long ans = count(r) - count(l - 1);
        out.println(ans);
    }

    private long count(long x) {
        if (x == 0)
            return 0;
        long res = 0;
        String s = Long.toString(x);
        int len = s.length();
        long tmp = 9;
        for (int i = 1; i <= len; i++) {
            long cur = (long) Math.pow(10, i);
            if (x >= cur) {
                res += tmp;
                if (i >= 2)
                    tmp *= 10L;
            } else {
                for (int j = 1; j <= 9; j++) {
                    if (j < s.charAt(0) - '0') {
                        res += Math.pow(10, Math.max(i - 2, 0));
                    }
                    if (j == s.charAt(0) - '0') {
                        long t = 0;
                        for (int k = 1; k < i - 1; k++) {
                            t = t * 10 + s.charAt(k) - '0';
                        }
                        if (j <= s.charAt(len - 1) - '0') {
                            res += t;
                        } else {
                            res += t - 1;
                        }
                    }
                }
            }

        }
        return res;
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class LittleElephantandInterval {

	static long solve(String l){
		long res = 0;
		if(l.length() == 1)
			res += (10 - Integer.parseInt(l));
		else {
			if(l.charAt(0) < l.charAt(l.length() - 1)){
				res += (Math.pow(10, l.length() - 2) - (l.length() > 2 ?Integer.parseInt(l.substring(1, l.length() - 1)) : 0) - 1);
			}else{
				res += (Math.pow(10, l.length() - 2) - (l.length() > 2 ?Integer.parseInt(l.substring(1, l.length() - 1)) : 0));
			}
			res += (9 - Integer.parseInt(l.charAt(0) + "")) * Math.pow(10, l.length() - 2);
		}
		return res;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		String l = sc.next();
		String r = sc.next();

		long res = 0;

		for (int i = Math.max(0, l.length() - 2) + 1; i <= r.length() - 2 - 1; i++) {
			res += 9 * Math.pow(10, i);
		}

		res += solve(l);

		if(r.length() == l.length())
			res -= solve(r);
		else
			res += 9 * Math.pow(10, r.length() - 2) - solve(r) ;

		if(r.charAt(0) == r.charAt(r.length() - 1))
			res++;

		System.out.println(res);

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}

}

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

public class CF204A {
    public static void main(String[] args) {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        Application solver = new Application();
        solver.solve(System.in, out);

        out.close();
    }
}

class Application {
    long count(long number) {
        String s = number + "";

        if (s.length() == 1) {
            return number;
        }
        else if (s.length() == 2) {
            return number / 11 + 9;
        }
        else {
            long mid = Long.parseLong(s.substring(1, s.length() - 1));
            long first = Long.parseLong(s.charAt(0) + "");
            long last = Long.parseLong(s.charAt(s.length()-1) + "");

            long c = 0;
            for (int i = 1; i <= s.length() - 1; i++) {
                if (i == 1 || i == 2) {
                    c += 9;
                }
                else {
                    c += Math.pow(10, i-2)*9;
                }
            }

            c += Math.pow(10, s.length()-2)*(first-1);

            if (first < last) {
                c += mid+1;
            }
            else {
                c += mid;
            }
            return c;
        }
    }

    public void solve(InputStream in, PrintWriter out) {
        Scanner scanner = new Scanner(in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();

        //out.println(a + " " + count(a));
        //out.println(b + " " + count(b));
        out.println(count(b) - count(a-1));
    }
}

import java.io.*;
import static java.lang.Math.*;
import static java.lang.Long.*;
@SuppressWarnings("unused")

public class round129C {

    public static long compute(long x){
        String s = ("" + x);
        int sz = s.length();
        int st = s.charAt(0) - '0';
        int ed = s.charAt(sz - 1) - '0';
        long ans = 0;
        for(int i = 1 ; i <= sz ; ++i){
            if(i == 1){
                for(int j = 1 ; j < 10 ; ++j)
                    if(j <= x)
                        ++ans;
            }else{
                if(i == 2){
                    for(int j = 1 ; j < 10 ; ++j){
                        if((j * 10 + j) <= x)
                            ++ans;
                    }
                }else{
                    int rem = i - 2;
                    if(i < sz){
                        for(int j = 1 ; j < 10 ; ++j){
                            ans += (long)pow(10, rem);
                        }
                    }else{
                        for(int j = 1 ; j < 10 ; ++j){
                            if(j > st)
                                break;
                            if(j < st)
                                ans += pow(10, rem);
                            if(j == st){
                                for(int k = 1 ; k <= rem ; ++k){
                                    int cur = s.charAt(k) - '0';
                                    ans += (cur * (long)pow(10, rem - k));
                                }
                                if(j <= ed)
                                    ++ans;
                            }
                        }
                    }
                }
            }
        }
        return ans;
    }
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String [] use = br.readLine().split(" ");
        long start = parseLong(use[0]);
        long end = parseLong(use[1]);
        long upper = compute(end);
        long lower = compute(start);
        long ans = upper - lower;
        if(use[0].charAt(0) == use[0].charAt(use[0].length() - 1))
            ++ans;
        //System.out.println(upper);
        //System.out.println(lower);
        System.out.println(ans);
    }
}

import java.util.Scanner;

public class C_Litter_Elephant_And_Interval {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		long l=input.nextLong(),r=input.nextLong();
		long count1=1,count2=1;
		long l1=l,r1=r;
		while(l1/10>9){
			l1=l1/10;
			count1++;
		}
		l1=l1/10;
		count1++;
		//System.out.println("count1="+count1);
		while(r1/10>9){
			r1=r1/10;
			count2++;
		}
		r1=r1/10;
		count2++;
		//System.out.println("count2="+count2);
		int i;long count=0;long countex=9,countin=9;
		if(l<10)countex=l-1;
		else if(l<100){
			l1=l/10;
			l=l%10;
			//System.out.println("l1="+l1);
			//System.out.println("l="+l);
			if(l1>l)countex=l1+8;
			else countex=l1+9;
			if(l1==l)countex--;
		}
		else{
			for(i=1;i<count1-2;i++)countex=countex*10+9;
			countex=countex+9;
			//System.out.println("countex now="+countex);
			//System.out.println("l1="+l1);
			//System.out.println("l%10="+l%10);
			if(l1<=l%10){
				if(l1==l%10)countex--;
				long j=1,k;
				for(k=1;k<count1-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("l1="+l1);
				countex=countex+j*(l1-1);
				//System.out.println("countex now="+countex);
				j=j*10*l1;
				l1=l%j;
				//System.out.println("l1="+l1);
				l1=l1/10;
				//System.out.println("l1="+l1);
				countex=countex+l1+1;
				//if(l1==l%10)countex--;
				//System.out.println("countex="+countex);
			}
			else{
				long k,j=1;
				for(k=0;k<count1-2;k++)j=j*10;
				k=(l1-1)*j;
				countex=countex+k;
				for(i=0;i<count1-1;i++)l1=l1*10;
				l=l%l1;
				l=l/10;
				countex=countex+l;
				//System.out.println("countex="+countex);
			}
		}

		if(r<10)countin=r-1;
		else if(r<100){
			r1=r/10;
			r=r%10;
			if(r1>r)countin=r1+8;
			else countin=r1+9;
			//if(r1==r)countin--;
		}
		else{
			for(i=1;i<count2-2;i++)countin=countin*10+9;
			countin=countin+9;
			//System.out.println("countin now="+countin);
			//System.out.println("r1="+r1);
			//System.out.println("r%10="+r%10);
			if(r1<=r%10){
				long j=1,k;
				for(k=1;k<count2-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("r1="+r1);
				countin=countin+j*(r1-1);
				//System.out.println("countin now="+countin);
				j=j*10*r1;
				r1=r%j;
				//System.out.println("r1="+r1);
				r1=r1/10;
				//System.out.println("r1="+r1);
				countin=countin+r1+1;
				//System.out.println("countin="+countin);
			}
			else{
				long k,j=1;
				for(k=0;k<count2-2;k++)j=j*10;
				k=(r1-1)*j;
				countin=countin+k;
				//System.out.println("countin now="+countin);
				for(i=0;i<count2-1;i++)r1=r1*10;
				r=r%r1;
				r=r/10;
				//System.out.println("r=="+r);
				countin=countin+r;
				//System.out.println("countin="+countin);
			}
		}
		//System.out.println("countex="+countex);
		//System.out.println("countin="+countin);
		count=countin-countex;
		System.out.println(count);
	}
}

//Little Elephant and Interval
//129 Div2 C

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class template
{
    public static BufferedReader br;
    public static StringTokenizer inp;
    public static PrintWriter out;
    public static void main(String[] args)  throws IOException
    {

        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long r,l;
        read();
        l = nextLong(); r= nextLong();

        out.println(calc(r)-calc(l-1));

        br.close();
        out.close();
    }

    static long calc(long n)
    {
        if(n<10)return n;
        if(n<100)return 9+(n%10>=n/10?n/10:n/10-1);
        int len = (int)(Math.log10(n)+1+1e-8);
        int ld = (int)(n%10);
        int fd = (int)(n/(long)(Math.pow(10, len-1)+1e-8));

        long ans = 18;
        long pow=1;
        for(int i = 1; i <= len-3 ; i++)
        {
            pow*=10;
            ans+=pow*9;
        }
        pow*=10;

        ans+= (fd-1)*pow + (n/10-pow*fd+1) - (fd>ld?1:0);

        return ans;
    }

    public static void read() throws IOException{inp = new StringTokenizer(br.readLine());}
    public static int nextInt(){return Integer.parseInt(inp.nextToken());}
    public static long nextLong(){return Long.parseLong(inp.nextToken());}
    public static double nextDouble(){return Double.parseDouble(inp.nextToken());}
    public static String next(){return inp.nextToken();}

}

/*
Rohit Singh
29 December 2018
1523
*/
import java.util.* ;
import java.io.* ;

public class ElephantInterval
{
    static boolean debug = false ;
    public static void main(String args[]) throws Exception
    {
        BufferedReader bro = new BufferedReader(new InputStreamReader(System.in)) ;
        long[] arr = new long[18] ;
        arr[0] = 9L ;
        arr[1] = 18L ;
        for(int i=2;i<18;i++)
        {
            arr[i] = 9L*(long)Math.pow(10L,i-1) ;
            arr[i] = arr[i]+arr[i-1] ;
        }

        String[] S = bro.readLine().split(" ") ;
        long a = Long.parseLong(S[0]) ;
        long b = Long.parseLong(S[1]) ;
        long aA = getAns(a,arr) ;
        long bA = getAns(b,arr) ;
        if(debug)
        {
            System.out.println("arr :"+Arrays.toString(arr));
            System.out.println("aA :"+aA+" bA :"+bA);
            System.out.println("isGood :"+a+" "+isGood(a));
        }
        System.out.println((bA-aA+(isGood(a)?1:0)));
    }
    static boolean isGood(long a)
    {
        int digits = getDigits(a) ;
        long msd = a/(long)Math.pow(10,digits-1) ;
        long lsd = a%10 ;
        if(msd==lsd) return true ;
        else return false ;
    }
    static long getAns(long val,long[] arr)
    {
        int digits = getDigits(val) ;
        if(digits==1)
            return val ;
        long ans = arr[digits-2] ;
        long msd = val/(long)Math.pow(10,digits-1) ;
        ans+=(msd-1)*Math.pow(10,digits-2) ;
        long lsd = val%10 ;
        long temp = (val%((long)Math.pow(10,digits-1))/10) ;
        if(lsd>=msd) ans+=temp+1 ;
        else if(lsd<msd) ans+=temp ;
        return ans ;
    }
    static int getDigits(long val)
    {
        int d = 0 ;
        while(val!=0)
        {
            val/=10 ;
            d++ ;
        }
        return d ;
    }

}

import java.util.Scanner;

public class CF_129C {

	static long f(long n) {
		if (n < 10)
			return n;
		long ret = n / 10 - 1;
		int firstDigit = Long.toString(n).charAt(0) - '0';
		int lastDigit = (int) n % 10;
		if (firstDigit <= lastDigit)
			ret++;
		ret += 9;
		return ret;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long l = sc.nextLong();
		long r = sc.nextLong();
		System.out.println(f(r) - f(l - 1));
	}
}

import java.util.Scanner;

public class prime_less {
    public static void main(String[] args)  throws Exception{
        new prime_less().run(args);

    }
    static long[] store;

    private void run(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        String fir = input.next();
        String sec = input.next();
        store = new long[20];
        store[0] = 9;
        for(int i = 1; i < 20; i++){
            store[i] = (long) (store[i-1]+9*Math.pow(10, i-1));
        }
        System.out.println(calc(sec) + " " +  (calc(fir)-check(fir)));
    }

    private int check(String num){
        int len = num.length();
        if(len == 1)
            return 1;
        int begin = Integer.parseInt(num.substring(0, 1));
        int end = Integer.parseInt(num.substring(len-1, len));
        if(begin == end)
            return 1;
        else
            return 0;
    }
    private long calc(String num){
        int len = num.length();
        if(len == 1)
            return Long.parseLong(num);
        else if(len >= 19){
            return new Long("100000000000000008");
        }
        else{
            int begin = Integer.parseInt(num.substring(0, 1));
            int end = Integer.parseInt(num.substring(len-1, len));
            long between = 0;

            if(len == 2){
                between = 1;
            }
            else{
                between = Long.parseLong(num.substring(1, len-1))+1;
            }
            //System.out.println(store[len-2]);
            //System.out.println(begin + " " + between +" " + end);
            if(end >= begin){
                return (long) (between+(begin-1)*Math.pow(10, len-2) + store[len-2]);
            }
            else{
                return (long) (between-1 + (begin-1)*Math.pow(10, len-2) + store[len-2]);
            }

        }
    }

}

import java.util.Scanner;

public class Codeforces204A {

	    static long meth(long a){
	        if(a < 10)return a;
	        long p = a/10;
	        p = p+8;
	        long f = a;
	        while(f>=10) f/= 10;
	        if (f <= a % 10) p++;
	        return p;
	    }

	    public static void main(String[] args){
	        Scanner sc = new Scanner(System.in);
	        long a = sc.nextLong();
	        long b = sc.nextLong();
	        System.out.println(meth(a));
	        System.out.println(meth(b));
	        long ans = meth(b) - meth(a) + 1 ;
	        System.out.println(ans);

	        sc.close();
	    }

}

import java.util.Scanner;

public class CF204A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long L = in.nextLong();
        long R = in.nextLong();
        String LS = new Long(L).toString();
        String RS = new Long(R).toString();

        long ans = 0;
        for(int d=1; d<=9; d++) {
            if(L <= d && d<=R) ans++;
        }

        for(int d=1; d<=9; d++) {
            for(int len = 1; len<=17; len++) {
                long st = d + (long)(Math.pow(10,len))*d;
                long ed = st + (long)Math.pow(10, len)-10;
                if(ed < L || st > R) continue;

                st = (st-d)/10;
                ed = (ed-d)/10;
                long myL = L/10 + (L%10 >= d ? 1 : 0);
                long myR = R/10 + (R%10 < d ? -1 : 0);

                st = Math.max(st, myL);
                ed = Math.min(ed, myR);
           //     System.out.println(st+" "+ed);

                ans += ed-st+1;
            }
        }
        System.out.println(ans);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_204A solver = new CF_204A();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_204A {
        long[] tenPower = power(18);

        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            long l = in.l(), r = in.l();
            out.println(cal(r) - cal(l - 1));
            //cal(1010);
        }

        long cal(long mx) {
            if (mx < 10) return mx;
            long ten = 1, ans = 0;
            int digits = 1;
            while (ten <= mx) {
                for (int i = 1; i <= 9 && i * ten <= mx; ++i) {
                    if ((i + 1) * ten <= mx) {
                        if (ten == 1)
                            ans++;
                        else
                            ans += tenPower[digits - 2];
                    }
                    else if (i * ten + i <= mx) {
                        ans += 1 + (mx / 10 - i * (ten / 10));
                        if (i > mx % 10) ans--;
                    }
                }

                ten *= 10;
                digits++;
            }
            return ans;
        }

        long[] power(int max) {
            long[] rs = new long[max + 1];
            rs[0] = 1;
            for (int i = 1; i <= max; ++i)
                rs[i] = rs[i - 1] * 10;
            return rs;
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            long l() {
                return in.nextLong();
            }

        }

    }
}

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

public class con129_C {

    public static void main( final String[] args ) throws Exception {
        final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        final long[] tmp = toi( br.readLine().split( " " ) );
        System.out.println( solve( tmp[0], tmp[1] ) );
    }

    public static long solve( final long from, final long to ) {
        return solve( to ) - solve( from - 1 );
    }

    public static long solve( final long to ) {
        final String tos = Long.toString( to );
        final int sl = tos.length();
        int cnt = 0;
        if ( sl == 1 ) {
            return to;
        }
        cnt += to / 10 - 1 + 9;
        final int fc = tos.charAt( 0 ) - '0';
        if ( ( to / 10 ) * 10 + fc <= to ) ++cnt;
        return cnt;
    }

    private static long pow( final int a, final int n ) {
        long res = 1L;
        for ( int i = 0; i < n; i++ ) {
            res *= a;
        }
        return res;
    }

    public static long[] toi( final String[] sa ) {
        final long[] res = new long[ sa.length ];
        for ( int i = 0; i < res.length; i++ ) {
            res[i] = toi( sa[i] );
        }
        return res;
    }

    public static long toi( final String s ) {
        return Long.parseLong( s );
    }

}

import java.io.*;
import java.util.StringTokenizer;
import static java.util.Arrays.*;

public class Main {

    long res[] = new long[111];

    long fun(long i) {
        if (i <= 100) return res[(int)i];

        long p = 1;
        while (p*10 < i) p*=10;

        while (i/p != i%10) {
            i--;

            if (i <= 10) return i;

            p = 1;
            while (p*10 < i) p*=10;
        }

        if (i <= 10) return i;
        if (i <= 100) return res[(int)i];

        long hwm = i%10;

        i = i%p;
        i = i/10;

        p = p/10;

        return (i+1) + p*(hwm-1) + fun(p*10);
    }

    boolean isOk(long i) {
        if (i < 10) return true;

        long p = 1;
        while (p*10 < i) p*=10;

        if (i/10 == i%10) return true;

        return false;
    }

    void solve() throws IOException {
        long l = nextLong();
        long r = nextLong();

        for (int i = 0; i < 10; ++i) {
            res[i] = i+1;
        }

        for (int i = 10; i <= 100; ++i) {
            res[i] = res[i-1];
            if (i/10 == i%10) res[i]++;
        }

        System.out.println(fun(r) - fun(l) + (isOk(l) ? 1 : 0));
//      System.out.println(fun(r));
    }

    class MultiList {
        int[] head, next, dest;
        int en;

        MultiList(int vNum, int eNum) {
            head = new int[vNum];
            next = new int[eNum + 1];
            dest = new int[eNum + 1];
            clearGraph();
        }

        void clearGraph() {
            fill(head, -1);
            en = 0;
        }

        void addEdge(int u, int v) {
            dest[en] = v;
            next[en] = head[u];
            head[u] = en;
            en++;
        }
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileIn = "input.txt";
    final String fileOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {
        if (new File(fileIn).exists())
            in = new BufferedReader(new FileReader(fileIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
//      out = new PrintWriter(new FileWriter(fileOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class C
{
    BufferedReader in;
    PrintStream out;
    StringTokenizer tok;
    public C() throws NumberFormatException, IOException
    {
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new BufferedReader(new FileReader("in.txt"));
        out = System.out;
        run();
    }
    int log10(long a)
    {
        if(a==0 || a==1) return 1;
        for(int i = 0; i <=18; i++)
            if(pot10[i]>a)
                return i;
        return 0;
    }
    long[] pot10;
    int first(long a)
    {
        return (int)(a/pot10[log10(a)-1]);
    }
    int last(long a)
    {
        return (int)(a%10);
    }
    long middle(long a)
    {
        return (a%pot10[log10(a)-1])/10;
    }
    long topot10(long a)
    {
        if(a<10)return 10-a;
        if(a<100)
        {
            int ans = 10-first(a);
            if(first(a)<last(a))ans--;
            return ans;
        }
        long res = (9-first(a))*pot10[log10(a)-2];
        long m = middle(a);
        res+= pot10[log10(a)-2]-m;
        if(first(a)<last(a))res--;
        return res;
    }
    void run() throws NumberFormatException, IOException
    {
        pot10 = new long[19];
        pot10[0] = 1;
        for(int i = 1; i <=18; i++)
            pot10[i] = pot10[i-1]*10;
        long[] cant = new long[19];
        cant[0] = 1;
        cant[1] = 10;
        for(int i = 2; i <= 18;i++)
            cant[i] = pot10[i-2]*9 + cant[i-1];

        long a = nextLong();
        long b = nextLong();
        long ans = 0;
        int pot_a = log10(a);
        int pot_b = log10(b);
        ans = topot10(a);
        if(pot_b!=pot_a)
            ans+= cant[pot_b-1] - cant[pot_a];
        ans+= (cant[log10(b+1)]-cant[log10(b+1)-1]-topot10(b+1));
        out.println(ans);
    }
    public static void main(String[] args) throws NumberFormatException, IOException
    {
        new C();
    }
    String nextToken() throws IOException
    {
        if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }
    int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}

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

public class Main
{

	static long pow_10[]=new long[19];

	static long find_upto(long n){

		if(n<=10)
			return n;

		char ch[]=(String.valueOf(n)).toCharArray();

		int len=ch.length;

		long arr[]=new long[len+1];

		for(int i=0;i<len;i++)
			arr[i]=ch[i]-'0';
		long res=9l;

		for(int i=1;i<len-1;i++){
			int digs=len-i-2;
			if(digs<0)
				break;

			res+=(pow_10[digs]*9l);

		}

		res+=(pow_10[len-2]*(arr[0]-1l));

		if(len==2){
			if(arr[0]<arr[1])
				res++;//System.out.println("res "+res);
			return res;
		}

		long corner=Long.parseLong((String.valueOf(n)).substring(1,len-1));

		if(arr[0]>arr[len-1])
			corner--;

		res+=corner+1l;//System.out.println("res "+res);

		return res;
	}

    public static void process()throws IOException
    {
    	long l=nl(),r=nl();

    	long res=find_upto(r)-find_upto(l-1);
    	pn(res);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
    	pow_10[0]=1l;
    	for(int i=1;i<=18;i++) pow_10[i]=10l*pow_10[i-1];

        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
		//t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    long cal(long c) {
        String s = c+"";
        int l = s.length();
        long r = min(9, c);
        long t = 1;
        for (int i=2; i<l; i++) {
            r += 9*t;
            t *= 10;
        }
        if (l==2) {
            r += c/11;
        } else if (l>2) {
            t = 1;
            for (int i=2; i<=l; i++) t *= 10;

            int d = s.charAt(0)-'0';
            r += (d-1)*t+Integer.parseInt(s.substring(1, l-1));
            if (s.charAt(0)<=s.charAt(l-1)) {
                r++;
            }
        }
        return r;
    }

    public A() throws Exception {
        long l = in.nextLong();
        long r = in.nextLong();
        System.out.println(cal(r)-cal(l-1));
    }

    Scanner in = new Scanner(System.in);
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	static long l,r;
	static long bs(int between,int bound)
	{
		long hi = 0;
		for (int i = 0; i < between; i++)
			hi+= 9 * pow(10,i);
		long lo = 0 , ans = 0;
		while(lo<=hi)
		{
			long mid = lo + (hi-lo) / 2;
			long cur = f(bound,mid,between+1);
			if(cur<=r && cur>=l)
				ans = Math.max(ans, cur);
			if(cur>r)
				hi = mid-1;
			else if(cur<r)
				lo = mid+1;
			else if(cur==r)
				break;
		}
		return count(ans,between);
	}
	static long count(long n,int bet)
	{
		if(n<l || n>r)return 0;
		long ans = 1;
		String s = n+"";
		int last = Integer.parseInt(s.charAt(1)+"");
		while((n/=10)>=100)
			ans *= 1l * ((n%10)+1);
		return ans + (last * pow(10,bet-1));
	}
	static long f(long bound,long mid,int pos)
	{
		mid *= 10;
		return mid + bound + (bound*pow(10,pos));
	}
	static long pow(long a,long b)
	{
		long ans = 1;
		while(b-->0)ans*=a;
		return ans;
	}
	public static void main(String[] args) throws Throwable {
		Scanner sc = new Scanner((System.in));
		l = sc.nextLong();
		r = sc.nextLong();
		long ans = 0;
		for (int i = 0; i < 10; i++)
			if(i>=l && i<=r)
				ans++;
		for (int i = 1; i < 10; i++)
		{
			if(i*10 + i >= l && i*10 + i<=r)ans++;
		}
		for (int between = 1; between <= 17; between++)
		{
			for(int bound = 1;bound<10;bound++)
			{
				ans += bs(between, bound);
			}
		}
		System.out.println(ans);
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

		public String nextLine() throws IOException {return br.readLine();}

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

		public boolean ready() throws IOException {return br.ready();}

	}

}

import java.util.Scanner;

public class C205 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long left = in.nextLong();
        long right = in.nextLong();
        long r = cal(right);
        long l = cal(left - 1);
        System.out.println((r - l));
    }

    private static long cal(long l) {
        if (l < 10) {
            return l;
        }
        char[] digits = (l + "").toCharArray();
        int first = digits[0];
        int length = digits.length;
        int last = digits[length - 1];
        long mid = 0;
        for (int i = 1; i < length - 1; ++i) {
            mid = mid * 10 + digits[i] - '0';
        }
        long result = 0;
        if (first > last) {
            result--;
        }

        result += mid + 1;
        result += (first - '0' - 1) * Math.pow(10, Math.max(0, length - 2));

        long k = 0;
        if (length >= 2) {
            k++;
        }
        long t = 1;
        for (int i = 2; i < length; ++i) {
            k += t;
            t *= 10;
        }

        k *= 9;
        result += k;
        return result;
    }
}

import java.util.Scanner;

public class Main {

    public static long getWays(long n){
        char[] chs = (n + "").toCharArray();

        if(chs.length <= 2){
            return chs[0] - '0' +  (chs[0] > chs[chs.length - 1]? 0: 1);
        }

        long res = (chs[0] - '1') * Math.round(Math.pow(10, chs.length - 2));

        for(int i = 1; i + 1 < chs.length; i++){
            res += (chs[i] - '0') * Math.round(Math.pow(10, chs.length - 2 - i));
        }

        return res + (chs[0] > chs[chs.length - 1]? 0: 1);
    }

    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);

        long l = scan.nextLong();
        long r = scan.nextLong();

        long[] ways = {0, 9, 9, 90, 900, 9000, 90000, 900000, 9000000, 90000000, 900000000, 9000000000L, 90000000000L,900000000000L,9000000000000L,90000000000000L,900000000000000L,9000000000000000L,90000000000000000L,900000000000000000L,9000000000000000000L};

        for(int i = 1; i < ways.length; i++) ways[i] += ways[i - 1];

        long res = (ways[Long.valueOf(r ).toString().length() - 1] + getWays(r) - ways[Long.valueOf(l - 1).toString().length() - 1] - getWays(l - 1));

        System.out.print(res);

    }
}

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

public class Main
{

	static long pow_10[]=new long[19];

	static long find_upto(long n){

		if(n<=10)
			return n;

		char ch[]=(String.valueOf(n)).toCharArray();

		int len=ch.length;

		long arr[]=new long[len+1];

		for(int i=0;i<len;i++)
			arr[i]=ch[i]-'0';
		long res=9l;

		for(int i=1;i<len-1;i++){
			int digs=len-i-2;
			if(digs<0)
				break;

			res+=(pow_10[digs]*9l);

		}

		res+=(pow_10[len-2]*(arr[0]-1l));

		if(len==2){

			if(arr[0]<=arr[1])
				res++;
			return res;
		}

		long corner=Long.parseLong((String.valueOf(n)).substring(1,len-1))+1l;

		if(arr[0]>=arr[len-1])
			corner--;
		res+=corner;
		return res;
	}

    public static void process()throws IOException
    {
    	long l=nl(),r=nl();

    	long res=find_upto(r)-find_upto(l-1);
    	pn(res);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
    	pow_10[0]=1l;
    	for(int i=1;i<=18;i++) pow_10[i]=10l*pow_10[i-1];

        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
		//t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.util.Scanner;

public class prime_less {
    public static void main(String[] args)  throws Exception{
        new prime_less().run(args);

    }
    static long[] store;

    private void run(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        String fir = input.next();
        String sec = input.next();
        store = new long[20];
        store[0] = 9;
        for(int i = 1; i < 20; i++){
            store[i] = (long) (store[i-1]+9*Math.pow(10, i-1));
        }
        System.out.println(calc(sec) -  (calc(fir)-check(fir)));
    }

    private int check(String num){
        int len = num.length();
        if(len == 1)
            return 1;
        int begin = Integer.parseInt(num.substring(0, 1));
        int end = Integer.parseInt(num.substring(len-1, len));
        if(begin == end)
            return 1;
        else
            return 0;
    }
    private long calc(String num){
        int len = num.length();
        if(len == 1)
            return Long.parseLong(num);
        else if(len >= 19){
            return new Long("100000000000000008");
        }
        else{
            int begin = Integer.parseInt(num.substring(0, 1));
            int end = Integer.parseInt(num.substring(len-1, len));
            long between = 0;

            if(len == 2){
                between = 1;
            }
            else{
                between = Long.parseLong(num.substring(1, len-1))+1;
            }
            //System.out.println(store[len-2]);
            //System.out.println(begin + " " + between +" " + end);
            if(end >= begin){
                return (long) (between+(begin-1)*Math.pow(10, len-2) + store[len-2]);
            }
            else{
                return (long) (between-1 + (begin-1)*Math.pow(10, len-2) + store[len-2]);
            }

        }
    }

}

//package a2oj_ladder_C;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TreeMap;
import java.util.TreeSet;

@SuppressWarnings("unused")
public class Elephant204A {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	int mod = (int)(Math.pow(10,9)+7);

	void solve()
	{
		long l = nl();
		long r = nl();
		long res = 0;

		if(l<10 && r<10) {
			out.println(r-l+1);
			return;
		}
		else if(l<10) {
			res += 10-l;
			l = 10;
		}
		//out.println(res);
		int ll = (l+"").length();
		int lr = (r+"").length();
		//out.println(ll+" "+lr);
		for(int i = ll+1 ; i<lr ; i++) {
			res += 9 * (long)Math.pow(10, i-2);
		}
		String sl = l+"";
		String sr = r+"";
		//out.println(res);
		if(ll < lr) {
			if(sl.charAt(ll-1)<=sl.charAt(0)) res++;

			for(int i = 0 ; i<ll-1 ; i++) {
				res += (9-(sl.charAt(i)-'0')) * Math.pow(10, (ll-i-2<0?0:ll-i-2));
			}
		}
		//out.println(res);
		if(sr.charAt(lr-1)>=sr.charAt(0)) res++;

		res += (sr.charAt(0)-'0'-1)*Math.pow(10, (lr-2<0?0:lr-2));
		for(int i = 1 ; i<lr-1 ; i++) {
			res += (sr.charAt(i)-'0')*Math.pow(10, (lr-i-2<0?0:lr-i-2));
		}
		out.println(res);
	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception { new Elephant204A().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int[][] na(int n , int m)
	{
		int[][] a = new int[n][m];
		for(int i = 0;i < n;i++)
			for(int j = 0 ; j<m ; j++) a[i][j] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	void display2D(int a[][]) {
		for(int i[] : a) {
			for(int j : i) {
				out.print(j+" ");
			}
			out.println();
		}
	}

	int[][] creategraph(int n , int m) {
		int g[][] = new int[n+1][];

		int from[] = new int[m];
		int to[] = new int[m];
		int ct[] = new int[n+1];

		for(int i = 0 ; i<m; i++) {
			from[i] = ni();
			to[i] = ni();
			ct[from[i]]++;
			ct[to[i]]++;
		}

		int parent[] = new int[n+1];

		for(int i = 0 ; i<n+1 ; i++) g[i] = new int[ct[i]];

		for(int i = 0 ; i<m ; i++) {
			g[from[i]][--ct[from[i]]] = to[i];
			g[to[i]][--ct[to[i]]] = from[i];
		}

		return g;
	}

	static long __gcd(long a, long b)
	{

		if(b == 0)
		{
			return a;
		}
		else
		{
			return __gcd(b, a % b);
		}
	}

	// To compute x^y under modulo m
	static long power(long x, long y, long p)
	{

		// Initialize result
		long res = 1;

		// Update x if it is more than or
		// equal to p
		x = x % p;

		while (y > 0)
		{

			// If y is odd, multiply x
			// with result
			if (y % 2 == 1)
				res = (res * x) % p;

			// y must be even now
			y = y >> 1; // y = y/2
		x = (x * x) % p;
		}

		return res;
	}

	// Function to find modular
	// inverse of a under modulo m
	// Assumption: m is prime
	static long modInverse(long a, int m)
	{
		if (__gcd(a, m) != 1) {
			//System.out.print("Inverse doesn't exist");
			return -1;
		}

		else {

			// If a and m are relatively prime, then
			// modulo inverse is a^(m-2) mode m
			//			System.out.println("Modular multiplicative inverse is "
			//											+power(a, m - 2, m));
			return power(a, m - 2, m);
		}
	}

	static long nCrModPFermat(int n, int r,
			int p , long fac[])
	{

		// Base case
		if (r == 0)
			return 1;

		// Fill factorial array so that we
		// can find all factorial of r, n
		// and n-r
		long t = (fac[n]* modInverse(fac[r], p))%p;

		return ( (t* modInverse(fac[n-r], p))% p);
	}

	private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class P204A {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(in, out);
		out.close();
	}

	static class Task {
		public void solve(InputReader in, PrintWriter out) {
			long l = in.nextLong();
			long r = in.nextLong();
			String sr = String.valueOf(r);
			int lenr = sr.length();
			long total = 0;
			if (l < 10 && r < 10) {
				out.println(r - l + 1);
				return;
			} else if (l < 10/*&&r>=10*/) {
				total += 10 - l;
				l = 11;
			}
			StringBuilder sl = new StringBuilder(String.valueOf(l));
			char ls = sl.charAt(0);
			char le = sl.charAt(sl.length() - 1);
			if (ls >= le) {
				sl.setCharAt(sl.length() - 1, ls);
			} else /*(ls<le)*/ {
				if (sl.length() > 2)
					total += (long) (Math.pow(10, sl.length() - 2) - Long.valueOf(sl.substring(1, sl.length() - 1)))
							- 1;
				sl.setCharAt(0, (char) (ls + 1));
				for (int i = 1; i + 1 < sl.length(); i++)
					sl.setCharAt(i, '0');
				sl.setCharAt(sl.length() - 1, (char) (1 + ls));
			}
			while (true) {
				long add = (long) (Math.pow(10, sl.length() - 2));
				if (sl.length() < lenr) {
					if (sl.length() > 2 && sl.charAt(1) != '0') {
						total += (9 - sl.charAt(0) + '0') * add
								+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
					} else {
						total += (9 - sl.charAt(0) + '0' + 1) * add;
					}
				} else {
					if (sl.charAt(0) == sr.charAt(0)) {
						if (sl.length() > 2) {
							long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
									- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
							if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
								diff--;
							}
							total += diff;
						} else
							total++;
					} else {
						int k = sr.charAt(0) - '0' - 1;
						if (sl.length() > 2 && sl.charAt(1) != '0') {
							total += (k - sl.charAt(0) + '0') * add
									+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
						} else {
							total += (k - sl.charAt(0) + '0' + 1) * add;
						}
						sl = new StringBuilder(
								String.valueOf((long) ((k + 1) + (k + 1) * Math.pow(10, sl.length() - 1))));
						if (Long.valueOf(sl.toString()) <= r) {
							if (sl.length() > 2) {
								long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
										- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
								if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
									diff--;
								}
								total += diff;
							} else
								total++;
						}

					}
					break;
				}
				sl = new StringBuilder(String.valueOf((long) (1 + Math.pow(10, sl.length()))));
			}
			out.println(total);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
}

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

public class Main
{

	static long pow_10[]=new long[19];

	static long find_upto(long n){

		if(n<=10)
			return n;

		char ch[]=(String.valueOf(n)).toCharArray();

		int len=ch.length;

		long arr[]=new long[len+1];

		for(int i=0;i<len;i++)
			arr[i]=ch[i]-'0';
		long res=9l;

		for(int i=1;i<len-1;i++){
			int digs=len-i-2;
			if(digs<0)
				break;

			res+=(pow_10[digs]*9l);

		}

		res+=(pow_10[len-2]*(arr[0]-1l));

		if(len==2){
			if(arr[0]<arr[1])
				res++;//System.out.println("res "+res);
			return res;
		}

		long corner=Long.parseLong((String.valueOf(n)).substring(1,len-1));

		if(arr[0]>arr[len-1])
			corner--;

		res+=corner+(corner==0?0:1l);//System.out.println("res "+res);

		return res;
	}

    public static void process()throws IOException
    {
    	long l=nl(),r=nl();

    	long res=find_upto(r)-find_upto(l-1);
    	pn(res);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
    	pow_10[0]=1l;
    	for(int i=1;i<=18;i++) pow_10[i]=10l*pow_10[i-1];

        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
		//t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
//        out.printLine(go(r));
//        out.printLine(go(l - 1));
        out.printLine(go(r) - go(l - 1));
    }

    private long go(long r) {
        if (r < 10) return r;
        int w = get2(r);

        long res = 0;
        int first = get(r);

        long t = 1;
        for (int i = 0; i < w - 1; i++) {
            t *= 10;
        }
        if (w > 2) {
            t *= first;
            t = r - t;
            t = t / 10;
            res += t;
        }
        if (r % 10 >= first) res++;

        if (first > 1) {
            int tt = 1;
            for(int i = 0; i < w - 2; i++) {
                tt *= 10;
            }
            res += (first - 1) * tt;
        }

        for (int i = 1; i < w; ++i)
            res += calc(i);
        return res;
    }

    long calc(int k) {
        if (k == 1 || k == 2) return 9;
        else {
            int res = 1;
            for(int i = 0; i < k - 2; i++) {
                res *= 10;
            }
            res *= 9;
            return res;
        }
    }

    int get(long k) {
        while (k >= 10) {
            k /= 10;
        }
        return (int) k;
    }

    int get2(long k) {
        int ans = 0;
        while (k != 0) {
            k /= 10;
            ans++;
        }
        return ans;
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

	}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        String left = jin.next();
        String right = jin.next();

        long count = 0;
        for(int i = left.length() + 1; i <= right.length(); i++) {
            if(i > 2) {
                count += 9 * Math.pow(10, i - 2);
            } else {
                count += 9;
            }
        }

        long cl = compute(left);
        long cr = compute(right);

        if(right.charAt(0) == right.charAt(right.length() - 1))
            cr--;

        jout.println(count + cl - cr);
    }

    private long compute(String left) {
        int val = (left.charAt(0) - '0') + 1;
        int len = Math.max(0, left.length()-2);

        long tot = (long) Math.pow(10, len);
        long result = (9 - val + 1) * tot;
        if(left.charAt(0) == left.charAt(left.length() - 1)) {
            if(left.length() > 1) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
            } else {
                result++;
            }
        } else {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
                if (left.charAt(left.length() - 1) > left.charAt(0))
                    result--;
            } else if(left.length() > 1) {
                if (left.charAt(left.length() - 1) < left.charAt(0))
                    result++;
            } else {
                result++;
            }
        }
        return result;
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                                            //(new FileReader("input.in"));
        StringBuilder out = new StringBuilder();
        StringTokenizer tk;
        //PrintWriter pw = new PrintWriter("output.out", "UTF-8");

        long [] nines = new long[20];
        nines[1] = 9l;
        for(int i=2; i<=19; i++)
            nines[i] = (nines[i-1]*10)+9l;

        long [] dp = new long[20];
        dp[1] = dp[2] = 9;

        for(int i=3; i<=19; i++)
            dp[i] = 9*(nines[i-2]+1);

        tk = new StringTokenizer(in.readLine());
        String s = tk.nextToken(),e = tk.nextToken();

        long ans = 0;

        if(e.length() == 1) ans = (e.charAt(0)-'0')-(s.charAt(0)-'0')+1;
        else if(s.length() == e.length()) {
            long a = 0,b = 0;
            if(e.length()==2) {
                a = min(e.charAt(0)-'0',e.charAt(e.length()-1)-'0');
                b = max(s.charAt(0)-'0',s.charAt(1)-'0');
            } else {
                long x = parseLong(e);
                while(true) {
                    String t = ""+x;
                    if(t.charAt(0) == t.charAt(t.length()-1) || t.length()<e.length())
                        break;
                    x--;
                }

                long y = parseLong(s);
                if(x < y) {
                    System.out.println("0");
                    return;
                }

                while(true) {
                    String t = ""+y;
                    if(t.charAt(0)==t.charAt(t.length()-1) || t.length()>s.length())
                        break;
                    y++;
                }

               String x1 = ""+x,x2 = ""+y;

               if(x2.length()<e.length()) a = 0;
               else a = (parseLong(x1.substring(1, x1.length()-1))+1)+(x1.charAt(0)-'0'-1)*(nines[x1.length()-2]+1);

               if(x1.length()>s.length()) b = 0;
               else b = (parseLong(x2.substring(1, x2.length()-1))+1)+(x2.charAt(0)-'0'-1)*(nines[x2.length()-2]+1);
            }

            if(a < b || (a==0 && b==0)) ans = 0;
            else ans = a-b+1;
        } else {
            for(int i=s.length()+1; i<e.length(); i++)
                ans += dp[i];

            long x = parseLong(e);
            while(true) {
                String t = ""+x;
                if(t.charAt(0) == t.charAt(t.length()-1) || t.length()<e.length())
                    break;
                x--;
            }

            long y = parseLong(s);

            while(true) {
                String t = ""+y;
                if(t.charAt(0)==t.charAt(t.length()-1) || t.length()>s.length())
                   break;
                y++;
           }

            String x1 = ""+x,x2 = ""+y;
            long a=0,b=0;

            if(x1.length()<e.length()) a = 0;
            else if(x1.length()>2)
                a = (parseLong(x1.substring(1, x1.length()-1))+1)+(x1.charAt(0)-'0'-1)*(nines[x1.length()-2]+1);
            else a = x1.charAt(0)-'0';

            if(x2.length()>s.length()) b = 0;
            else if(x2.length() > 2)
                b = (nines[x2.length()-2]-parseLong(x2.substring(1, x2.length()-1))+1)+(9-x2.charAt(0)-'0')*(nines[x2.length()-2]+1);
            else b = 9-(x2.charAt(0)-'0')+1;

            //System.out.println(x1+" "+x2);
            //System.out.println(b+" "+ans+" "+a);
            ans += a+b;
        }

        System.out.println(ans);
    }

}

import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collection;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
//        out.printLine(go(r));
//        out.printLine(go(l - 1));
        out.printLine(go(r) - go(l - 1));
    }

    private long go(long r) {
        if (r < 10) return r;
        int w = get2(r);

        long res = 0;
        int first = get(r);

        long t = 1;
        for (int i = 0; i < w - 1; i++) {
            t *= 10;
        }
        if (w > 2) {
            t *= first;
            t = r - t;
            t = t / 10;
            res += t;
        }
        if (r % 10 >= first) res++;

        if (first > 1) {
            res += (first - 1) * NumUtils.pow(10, w - 2, 1);
        }

        for (int i = 1; i < w; ++i)
            res += calc(i);
        return res;
    }

    long calc(int k) {
        if (k == 1 || k == 2) return 9;
        else {
            return (NumUtils.pow(10, k - 2, 1000000000000L) * 9);
        }
    }

    int get(long k) {
        while (k >= 10) {
            k /= 10;
        }
        return (int) k;
    }

    int get2(long k) {
        int ans = 0;
        while (k != 0) {
            k /= 10;
            ans++;
        }
        return ans;
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

	}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

class NumUtils {

    public static long pow(long a, long n, long module) {
        long res = 1;
        while (n > 0) {
            if ((n & 1) == 1) {
                res = res * a;
                res %= module;
                n--;
            } else {
                a = a * a;
                a %= module;
                n /= 2;
            }
        }
        return res;

    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        String left = jin.next();
        String right = jin.next();

        long count = 0;
        for(int i = left.length() + 1; i <= right.length(); i++) {
            if(i > 2) {
                count += 9 * Math.pow(10, i - 2);
            } else {
                count += 9;
            }
        }

        long cl = compute(left);
        long cr = compute(right);

        jout.println(count + cl - cr);
    }

    private long compute(String left) {
        int val = (left.charAt(0) - '0') + 1;
        int len = Math.max(0, left.length()-2);

        long tot = (long) Math.pow(10, len);
        long result = (9 - val + 1) * tot;
        if(left.charAt(0) == left.charAt(left.length() - 1)) {
            if(left.length() > 1) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
            } else {
                result++;
            }
        } else {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
                if (left.charAt(left.length() - 1) > left.charAt(0))
                    result--;
            } else if(left.length() > 1) {
                if (left.charAt(left.length() - 1) < left.charAt(0))
                    result++;
            } else {
                result++;
            }
        }
        return result;
    }
}

import java.util.Scanner;

public class C {

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		long a = scan.nextLong();
		long b = scan.nextLong();
		String sa = a + "";
		String sb = b + "";
		int lenA = sa.length();
		int lenB = sb.length();
		long ret = 0;
		for (int i = lenA; i <= lenB; i++)
		{
			String st = "";
			if (i == lenA)
				st = sa;
			else if (i == lenB)
				st = sb;
			else
			{
				st += "1";
				for (int k = 1; k < i - 1; k++)
					st += '9';
				st += '0';
			}
			long p = 1;
			for (int k = 1; k < st.length() - 1; k++)
				p *= (st.charAt(k) - '0' + 1);
			if (i == lenB)
			{
				p*= Math.min(st.charAt(0), st.charAt(lenB-1))-'0';
			} else
				p *= 9 - (st.charAt(0) - '0') + 1
						+ (st.charAt(0) < st.charAt(st.length() - 1) ? -1 : 0);
			ret += p;
		}
		System.out.println(ret);
	}

	static long c(int t)
	{
		return Math.max((long) Math.pow(10, t - 2), 1);
	}

}

/*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;

public class Main {
	static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static long mod=(long)1e9+7;
	static long mod1=998244353;
	static boolean sieve[];
	static ArrayList<Integer> primes;
	static ArrayList<Long> factorial;
/****************************************Solutions Begins***************************************************/
	static long dp[][][];
	static ArrayList<Integer> num;
	static int s=0;

	static long helper(int pos,int fdig,int small){
		if(pos==s&&s==1){
			return 1;
		}
		if(pos==s-1){
			if(small==0||fdig<=num.get(pos)){
				return 1;
			}
			else{
				return 0;
			}
		}
		if(dp[pos][fdig][small]!=-1){
			return dp[pos][fdig][small];
		}

		long ans=0;
		if(small==0){
			for(int i=0;i<=9;i++){
				ans+=helper(pos+1,fdig,0);
			}
		}
		else{
			for(int i=0;i<=9;i++){
				if(i<num.get(pos)){
					ans+=helper(pos+1,fdig,0);
				}
				else if(i==num.get(pos)){
					ans+=helper(pos+1,fdig,1);
				}
			}
		}
		dp[pos][fdig][small]=ans;
		return ans;
	}
	static long f(long n){
		num=new ArrayList<>();
		long n1=n;
		while(n1!=0){
			num.add((int)n1%10);
			n1/=10;
		}
		Collections.reverse(num);
		dp=new long[20][10][2];

		//debug(num);

		long ans=0;
		for(int i=1;i<=num.size();i++){
			s=i;
		for(long arr[][]:dp){
			for(long ar[]:arr){
				Arrays.fill(ar,-1);
			}
		}
			for(int j=1;j<=9;j++){
				if(j<num.get(0)||i<num.size()){
					ans+=helper(1,j,0);
				}
				else if(j==num.get(0)){
					ans+=helper(1,j,1);
				}
			}
		}
		return ans;
	}
	public static void main (String[] args) throws Exception {
		String st[]=br.readLine().split(" ");
		long l=Long.parseLong(st[0]);
		long r=Long.parseLong(st[1]);
		//out.println(f(9));
		//out.println(f(47));
		//out.println(f(l));
		out.println(f(r)-f(l-1));

/****************************************Solutions Ends*****************************************************/
		out.flush();
		out.close();
    }
/****************************************Template Begins***************************************************/

/*******************************************************TRIPLET********************************************/
	static class tripletComparator implements Comparator<triplet>{
		public int compare(triplet p1,triplet p2){
			if(p1.u<p2.u){
				return 1;
			}
			else if(p1.u>p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class triplet{
		int u;
		int v;
		int i;
		public triplet(int u,int v,int i){
			this.u=u;
			this.v=v;
			this.i=i;
		}
		public String toString() {
			return "[u=" + u + ", v=" + v + ", i="+i+"]";
		}
	}
/*********************************************PAIR*************************************************/
	static class PairComp implements Comparator<Pair>{
		public int compare(Pair p1,Pair p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class Pair implements Comparable<Pair> {
		int u;
		int v;
		int index=-1;
		public Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*******************************************LONG PAIR******************************************/
	static class PairCompL implements Comparator<Pairl>{
		public int compare(Pairl p1,Pairl p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
static class Pairl implements Comparable<Pair> {
		long u;
		long v;
		int index=-1;
		public Pairl(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*****************************************DEBUG***********************************************************/
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
/*****************************************NUMBER THEORY***********************************************/

/************************************MODULAR EXPONENTIATION************************************/
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
/*********************************************GCD*****************************/
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}
/*******************************************SIEVE*********************************/
	static void sieveMake(int n){
		sieve=new boolean[n];
		Arrays.fill(sieve,true);
		sieve[0]=false;
		sieve[1]=false;
		for(int i=2;i*i<n;i++){
			if(sieve[i]){
				for(int j=i*i;j<n;j+=i){
					sieve[j]=false;
				}
			}
		}
		primes=new ArrayList<Integer>();
		for(int i=0;i<n;i++){
			if(sieve[i]){
				primes.add(i);
			}
		}
	}
/***************************************FACTORIAL*********************************************************/
	static void fact(int n){
		factorial=new ArrayList<>();
		factorial.add((long)1);
		for(int i=1;i<=n;i++){
			factorial.add((factorial.get(i-1)*i)%mod);
		}
	}
/*******************************************ncr*********************************************************/
	static long ncr(int n,int k){
		long aa=modulo(factorial.get(n-k),mod-2,mod);
		long bb=modulo(factorial.get(k),mod-2,mod);
		long cc=factorial.get(n);
		long ans=(aa*cc)%mod;
		ans=(ans*bb)%mod;
		return ans;
	}
/***************************************STRING REVERSE****************************************************/
	static String reverse(String str){
		char r[]=new char[str.length()];
		int j=0;
		for(int i=str.length()-1;i>=0;i--){
			r[j]=str.charAt(i);
			j++;
		}
		return new String(r);
	}
}
/*******************************************************End***********************************************************/

import java.math.BigInteger;
import java.util.*;
import static java.lang.System.*;

public class Main {
    Scanner sc = new Scanner(in);

    public long getNum(long r){

        int d=String.valueOf(r).length()-1;
        if(d<1){
            return r;
        }
        long d10=1;
        for(long i=0;i<d;i++){
            d10*=10;
        }
        long top=(long)(r/d10);
        long bottom=r%10;
        long res=0;
        for(int i=1;i<top;i++){
            res+=Math.pow(10,d-1);
        }
        res+=(long)((r-top*d10)/10);
        if(top<=bottom)res++;

        return res+getNum(d10-1);
    }

    public void run() {
        long l=sc.nextLong(),r=sc.nextLong();
        int d=String.valueOf(l).length();
        long top=(long)(l/Math.pow(10,d));
        long bottom=l%10;

        ln(getNum(r)-getNum(l)+(top==bottom?1:0));

    }
    public static void main(String[] args) {
        new Main().run();
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

import java.util.Scanner;

public class prime_less {
    public static void main(String[] args)  throws Exception{
        new prime_less().run(args);

    }
    static long[] store;

    private void run(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        String fir = input.next();
        String sec = input.next();
        store = new long[19];
        store[0] = 9;
        for(int i = 1; i < 19; i++){
            store[i] = (long) (store[i-1]+9*Math.pow(10, i-1));
        }
        System.out.println(calc(sec) - (calc(fir)-check(fir)));
    }

    private int check(String num){
        int len = num.length();
        if(len == 1)
            return 1;
        int begin = Integer.parseInt(num.substring(0, 1));
        int end = Integer.parseInt(num.substring(len-1, len));
        if(begin == end)
            return 1;
        else
            return 0;
    }

    private long calc(String num){
        int len = num.length();
        if(len == 1)
            return Long.parseLong(num);
        else if(len >= 19){
            return new Long("100000000000000008");
        }
        else{
            int begin = Integer.parseInt(num.substring(0, 1));
            int end = Integer.parseInt(num.substring(len-1, len));
            long between = 0;
            if(len == 2){
                between = 1;
            }
            else{
                between = Long.parseLong(num.substring(1, len-1))+1;
            }
            if(end >= begin){
                return (long) (between+(begin-1)*Math.pow(10, len-2) + store[len-2]);
            }
            else{
                if(between-1 >= 0){
                    return (long) (between-1 + (begin-1)*Math.pow(10, len-2) + store[len-2]);
                }
                else{
                    return (long) ((begin-1)*Math.pow(10, len-2) + store[len-2]);
                }
            }
        }
    }

}

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

public class CF204A {
    public static void main(String[] args) {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        Application solver = new Application();
        solver.solve(System.in, out);

        out.close();
    }
}

class Application {
    long count(long number) {
        String s = number + "";

        if (s.length() == 1) {
            return number;
        }
        else if (s.length() == 2) {
            return number / 11 + 9;
        }
        else {
            long mid = Long.parseLong(s.substring(1, s.length() - 1));
            long first = Long.parseLong(s.charAt(0) + "");
            long last = Long.parseLong(s.charAt(s.length()-1) + "");

            long c = 0;
            for (int i = 1; i <= s.length() - 1; i++) {
                if (i == 1 || i == 2) {
                    c += 9;
                }
                else {
                    c += Math.pow(10, i-2)*9;
                }
            }

            c += Math.pow(10, s.length()-2)*(first-1);

            if (first < last) {
                c += mid+1;
            }
            else {
                c += mid;
            }
            return c;
        }
    }

    public void solve(InputStream in, PrintWriter out) {
        Scanner scanner = new Scanner(in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();

        //out.println(a + " " + count(a));
        //out.println(b + " " + count(b));
        out.println(count(b) - count(a-1));
    }
}

import java.util.Scanner;

public class C_Litter_Elephant_And_Interval {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		long l=input.nextLong(),r=input.nextLong();
		long count1=1,count2=1;
		long l1=l,r1=r;
		while(l1/10>9){
			l1=l1/10;
			count1++;
		}
		l1=l1/10;
		count1++;
		//System.out.println("count1="+count1);
		while(r1/10>9){
			r1=r1/10;
			count2++;
		}
		r1=r1/10;
		count2++;
		//System.out.println("count2="+count2);
		int i;long count=0;long countex=9,countin=9;
		if(l<10)countex=l-1;
		else if(l<100){
			l1=l/10;
			l=l%10;
			//System.out.println("l1="+l1);
			//System.out.println("l="+l);
			if(l1>l)countex=l+8;
			else countex=l1+9;
			if(l1==l)countex--;
		}
		else{
			for(i=1;i<count1-2;i++)countex=countex*10+9;
			countex=countex+9;
			//System.out.println("countex now="+countex);
			//System.out.println("l1="+l1);
			//System.out.println("l%10="+l%10);
			if(l1<=l%10){
				if(l1==l%10)countex--;
				long j=1,k;
				for(k=1;k<count1-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("l1="+l1);
				countex=countex+j*(l1-1);
				//System.out.println("countex now="+countex);
				j=j*10*l1;
				l1=l%j;
				//System.out.println("l1="+l1);
				l1=l1/10;
				//System.out.println("l1="+l1);
				countex=countex+l1+1;
				if(l1==l%10)countex--;
				//System.out.println("countex="+countex);
			}
			else{
				long k,j=1;
				for(k=0;k<count1-2;k++)j=j*10;
				k=(l1-1)*j;
				countex=countex+k;
				for(i=0;i<count1-1;i++)l1=l1*10;
				l=l%l1;
				l=l/10;
				countex=countex+l;
				//System.out.println("countex="+countex);
			}
		}

		if(r<10)countin=r-1;
		else if(r<100){
			r1=r/10;
			r=r%10;
			if(r1>r)countin=r+8;
			else countin=r1+9;
			//if(r1==r)countin--;
		}
		else{
			for(i=1;i<count2-2;i++)countin=countin*10+9;
			countin=countin+9;
			//System.out.println("countin now="+countin);
			//System.out.println("r1="+r1);
			//System.out.println("r%10="+r%10);
			if(r1<=r%10){
				long j=1,k;
				for(k=1;k<count2-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("r1="+r1);
				countin=countin+j*(r1-1);
				//System.out.println("countin now="+countin);
				j=j*10*r1;
				r1=r%j;
				//System.out.println("r1="+r1);
				r1=r1/10;
				//System.out.println("r1="+r1);
				countin=countin+r1+1;
				//System.out.println("countin="+countin);
			}
			else{
				long k,j=1;
				for(k=0;k<count2-2;k++)j=j*10;
				k=(r1-1)*j;
				countin=countin+k;
				//System.out.println("countin now="+countin);
				for(i=0;i<count2-1;i++)r1=r1*10;
				r=r%r1;
				r=r/10;
				//System.out.println("r=="+r);
				countin=countin+r;
				//System.out.println("countin="+countin);
			}
		}
		//System.out.println("countex="+countex);
		//System.out.println("countin="+countin);
		count=countin-countex;
		System.out.println(count);
	}
}

/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x204A
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         long A = Long.parseLong(st.nextToken());
         long B = Long.parseLong(st.nextToken());
         System.out.println(calc(B)-calc(A-1));
      }
      public static long calc(long B)
      {
         if(B <= 1000)
         {
            long cnt = 0;
            for(int i=1; i <= B; i++)
            {
               String temp = i+"";
               if(temp.charAt(0) == temp.charAt(temp.length()-1))
                  cnt++;
            }
            return cnt;
         }
         int len = (B+"").length();
         long res = 1L;
         for(int i=1; i <= len-1; i++)
         {
            if(i <= 2)
               res += 9;
            else
            {
               int mc = i-2;
               long temp = 9L;
               while(mc-->0)
                  temp *= 10;
               res += temp;
            }
         }
         //equal digit count
         int leftmost = Integer.parseInt((B+"").substring(0,1));
         long pow = 1L;
         for(int i=0; i < len-2; i++)
            pow *= 10;
         pow *= leftmost-1;
         String thing = B+"";
         long mid = Long.parseLong(thing.substring(1, thing.length()-1));
         res += pow+mid;
         return res;
      }
   }

/*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;

public class Main {
	static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static long mod=(long)1e9+7;
	static long mod1=998244353;
	static boolean sieve[];
	static ArrayList<Integer> primes;
	static ArrayList<Long> factorial;
/****************************************Solutions Begins***************************************************/

	private static long f(long x)
	{
		if(x < 10)
			return x;
		long ans = 9;
		int len = (""+x).length();
		long x0 = (""+x).charAt(0) - '0';
		long xl = (""+x).charAt(len-1) - '0';
		long x_ = 0;
		if(len > 2)
			x_ = Long.parseLong((x+"").substring(1, (x+"").length()-1));
		for (int d = 1; d < 10; d++)
		{
			long pw = 1;
			for (int i = 0; i < len-1; i++)
			{
				if(i < len-2 || (i == len-2 && d < x0))
					ans += pw;
				if(i == len-2)
				{
					if(d == x0)
						ans += x_;
					if(d == x0 && xl >= d)
						ans += 1;
				}

				pw *= 10;
			}
		}
		return ans;
	}
	public static void main (String[] args) throws Exception {
		String st[]=br.readLine().split(" ");
		long l=Long.parseLong(st[0]);
		long r=Long.parseLong(st[1]);

		//out.println(f(r)+" "+f(l));
		out.println(f(r)-f(l));

/****************************************Solutions Ends*****************************************************/
		out.flush();
		out.close();
    }
/****************************************Template Begins***************************************************/

/*******************************************************TRIPLET********************************************/
	static class tripletComparator implements Comparator<triplet>{
		public int compare(triplet p1,triplet p2){
			if(p1.u<p2.u){
				return 1;
			}
			else if(p1.u>p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class triplet{
		int u;
		int v;
		int i;
		public triplet(int u,int v,int i){
			this.u=u;
			this.v=v;
			this.i=i;
		}
		public String toString() {
			return "[u=" + u + ", v=" + v + ", i="+i+"]";
		}
	}
/*********************************************PAIR*************************************************/
	static class PairComp implements Comparator<Pair>{
		public int compare(Pair p1,Pair p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
	static class Pair implements Comparable<Pair> {
		int u;
		int v;
		int index=-1;
		public Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*******************************************LONG PAIR******************************************/
	static class PairCompL implements Comparator<Pairl>{
		public int compare(Pairl p1,Pairl p2){
			if(p1.u>p2.u){
				return 1;
			}
			else if(p1.u<p2.u){
				return -1;
			}
			else{
				return 0;
			}
		}
	}
static class Pairl implements Comparable<Pair> {
		long u;
		long v;
		int index=-1;
		public Pairl(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			if(index!=other.index)
				return Long.compare(index, other.index);
			return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
/*****************************************DEBUG***********************************************************/
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
/*****************************************NUMBER THEORY***********************************************/

/************************************MODULAR EXPONENTIATION************************************/
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
/*********************************************GCD*****************************/
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}
/*******************************************SIEVE*********************************/
	static void sieveMake(int n){
		sieve=new boolean[n];
		Arrays.fill(sieve,true);
		sieve[0]=false;
		sieve[1]=false;
		for(int i=2;i*i<n;i++){
			if(sieve[i]){
				for(int j=i*i;j<n;j+=i){
					sieve[j]=false;
				}
			}
		}
		primes=new ArrayList<Integer>();
		for(int i=0;i<n;i++){
			if(sieve[i]){
				primes.add(i);
			}
		}
	}
/***************************************FACTORIAL*********************************************************/
	static void fact(int n){
		factorial=new ArrayList<>();
		factorial.add((long)1);
		for(int i=1;i<=n;i++){
			factorial.add((factorial.get(i-1)*i)%mod);
		}
	}
/*******************************************ncr*********************************************************/
	static long ncr(int n,int k){
		long aa=modulo(factorial.get(n-k),mod-2,mod);
		long bb=modulo(factorial.get(k),mod-2,mod);
		long cc=factorial.get(n);
		long ans=(aa*cc)%mod;
		ans=(ans*bb)%mod;
		return ans;
	}
/***************************************STRING REVERSE****************************************************/
	static String reverse(String str){
		char r[]=new char[str.length()];
		int j=0;
		for(int i=str.length()-1;i>=0;i--){
			r[j]=str.charAt(i);
			j++;
		}
		return new String(r);
	}
}
/*******************************************************End***********************************************************/

import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        long left1 = scan.nextLong();
        long right1 = scan.nextLong();
        System.out.println(count(right1) - count(left1 - 1l));
    }
    static void px(Object ...objects){
        System.out.println(Arrays.deepToString(objects));
    }
    public static long count(long n1){
        if (n1 <= 10) return n1;
        long q1 = allDigitsSum(digits(n1));
        long q2 = fixedDigitsSum(n1);
//      px("cnt ", n1,q1,q2);
        return q1 + q2;
    }
    public static long fixedDigitsSum(long n1){
        int dig = digits(n1);
//      px("dig",dig);
        long first = firstDigit(n1);
        long fin =  (first - 1l);
//      px("fin",fin);
        for (int i = 0; i < dig - 2; i++){
            fin *= 10l;
        }

        long base = BigInteger.valueOf(10).pow(dig - 1).longValue() * first;
        long last = n1 % 10l;
        if (last >= first) fin++;
        long rmd = n1 - last - base;
        rmd /= 10l;
        fin += rmd;
//      px("rmd ",rmd);
//      px("fixed ", n1,fin, rmd,last >= first);
        return fin;
    }

    public static long allDigitsSum(int k1){
        long fin = 0;
        for (int i = 1;i < k1; i++){
            if (i == 1){
                fin += 9l;
            }
            else {
                long cur = 9l;
                for (int j = 0; j < i - 2; j++){
                    cur *= 10l;
                }
                fin += cur;
            }
        }
        return fin;
    }
    public static long firstDigit(long n1){
        for (;n1 >= 10l;){
            n1 /= 10l;
//          px(n1);
        }
        return n1;
    }
    public static int digits(long n1){
        int fin = 0;
        for (;n1 != 0;){
            n1 /= 10l;
            fin++;
        }
        return fin;
    }
}

import java.io.*;
import java.util.*;

public class C129{

        private BufferedReader in;
        private StringTokenizer st;
        PrintWriter out;
        int length;
        long []count = new long[19];
        String num;
        long [][][]dp;
        void solve() throws IOException{

            count[1] = count[2] = 9;
            for (int i = 3; i <= 18; i++) {
                count[i] = 10*count[i-1];
            }
            long l = nextLong();
            long u = nextLong();

            out.println(solve(u) - solve(l-1));

        }

        long howmany(int d,int tight,int first){

            if(d == length-1){
                if(num.charAt(d) >= num.charAt(0)) return 1;
                return 0;
            }
            if(dp[d][tight][first] != -1) return dp[d][tight][first];
            if(tight == 0){
                return dp[d][tight][first] = (long)Math.pow(10, length-d-1);
            }
            else{
                if(first == 1){
                    return dp[d][tight][first]= howmany(d+1, 1, 0);
                }
                else{
                    long ans = 0;
                    for (int i = 0; i < num.charAt(d)-'0'; i++) {
                        ans += howmany(d+1,0,0);
                    }
                    ans += howmany(d+1,1,0);
                    return dp[d][tight][first]=ans;
                }
            }
        }
        long solve(long k ){
            if(k == 0) return 0;
            int len = (k+"").length();
            if(len == 1) return k;
            long ans = 0;
            for (int i = 1; i < len; i++) {
                ans += count[i];
            }
            if(len >= 2){
                int a = (k+"").charAt(0) - '1';
                ans += a*(long)Math.pow(10, len-2);
            }
            length = len;
            num = (k+"");
            dp = new long[20][2][2];
            for (int i = 0; i < dp.length; i++) {
                for (int j = 0; j < dp[0].length; j++) {
                    Arrays.fill(dp[i][j], -1);
                }
            }
            ans += howmany(0,1,1);
            return ans;
        }

        C129() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            eat("");
            solve();
            out.close();
        }

        private void eat(String str) {
            st = new StringTokenizer(str);
        }

        String next() throws IOException {
            while (!st.hasMoreTokens()) {
                String line = in.readLine();
                if (line == null) {
                    return null;
                }
                eat(line);
            }
            return st.nextToken();
        }

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

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

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public static void main(String[] args) throws IOException {
            new C129();
        }

        int gcd(int a,int b){
            if(b>a) return gcd(b,a);
            if(b==0) return a;
            return gcd(b,a%b);
        }

}

import java.util.*;
import java.io.*;

public class P205C {

  private static void solve() {
    long a = nextLong();
    long b = nextLong();

    System.out.println(cnt(b) - cnt(a - 1));
  }

  private static long cnt(long x) {

    if (x < 10) {
      return x + 1;
    }

    if (x < 100) {
      return 10 + x / 10 - (x % 10 < x / 10 ? 1 : 0);
    }

    String str = String.valueOf(x);
    int n = str.length();

    long ans = 19;
    for (int i = 3; i < n; i++) {
      ans += (9 * (long)Math.pow(10, i - 2));
    }

    int cnt = str.charAt(0) - '0';

    ans += ((cnt - 1) * (Math.pow(10, n - 2)));

    for (int i = 1; i < n - 1; i++) {
      ans += (str.charAt(i) - '0') * Math.pow(10, n - i - 2);

    }

    ans += (str.charAt(n - 1) >= str.charAt(0) ? 1 : 0);

    return ans;
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

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

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

  public static void main(String[] args) {
    run();
  }
}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}
}

class Task {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
        long ans = count(r) - count(l - 1);
        out.println(ans);
    }

    private long count(long x) {
        long res = 0;
        String s = Long.toString(x);
        int len = s.length();
        long tmp = 9;
        for (int i = 1; i <= len; i++) {
            long cur = (long) Math.pow(10, i);
            if (x >= cur) {
                res += tmp;
                if (i >= 2)
                    tmp *= 10L;
            } else {
                for (int j = 1; j <= 9; j++) {
                    if (j < s.charAt(0) - '0') {
                        res += Math.pow(10, Math.max(i - 2, 0));
                    }
                    if (j == s.charAt(0) - '0') {
                        long t = 0;
                        for (int k = 1; k < i - 1; k++) {
                            t = t * 10 + s.charAt(k) - '0';
                        }
                        if (j <= s.charAt(len - 1) - '0') {
                            res += t;
                        } else {
                            res += t - 1;
                        }
                    }
                }
            }

        }
        return res;
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

}

import java.util.Scanner;

public class Dor {

	// xaspa impmentation

	static long dp[][][];
	static int left[];
	static int right[];

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		String l = in.next();
		String r = in.next();

		right = new int[r.length()];
		for(int i=0; i<r.length(); i++) {
			right[i] = r.charAt(i) - '0';
		}

		left = new int[l.length()];
		for(int i=0; i<l.length(); i++) {
			left[i] = l.charAt(i) - '0';
		}

		left[left.length-1]--;

		// start     digs left         wether we skip  or good
		dp = new long[10][right.length+1][2];

		for(int i=0; i<dp.length; i++) {
			for(int j=0; j<dp[i].length; j++) {
				for(int k=0; k<dp[i][j].length; k++) {
					dp[i][j][k] = -1;
				}
			}
		}

		long maxR = 0;

		if(r.length() == 1) {
			maxR = Integer.parseInt(r);
		}
		else {
			for(int i=1; i<=9; i++) {
				maxR += 1 + rec(i, (i <= right[0] ? 1 : 2),  (i > right[0] ? 1 : 0));
			}
		}

		for(int i=0; i<dp.length; i++) {
			for(int j=0; j<dp[i].length; j++) {
				for(int k=0; k<dp[i][j].length; k++) {
					dp[i][j][k] = -1;
				}
			}
		}

		long maxL = 0;

		if(l.length() == 1) {
			maxL = Integer.parseInt(l)-1;
		}
		else {
			for(int i=1; i<=9; i++) {
				maxL += 1 + rec2(i, (i <= left[0] ? 1 : 2),  (i > left[0] ? 1 : 0));
			}
		}

		System.out.println(maxR - maxL);

	}
	private static long rec2(int start, int digs, int k) {
		if(digs >= left.length)
			return 0;
		else if(dp[start][digs][k] != -1)
			return dp[start][digs][k];
		else {

			long ans = 0;

			if(digs == left.length-1) {

				if(k == 0) {
					return 1;
				}
				else {
					return 1;
				}

			}

			else {

				for(int i=0; i<=9; i++) {

					if(k == 0) {

						if(i <= left[digs]) {
							ans += (i == start ? 1 : 0) + rec(start, digs + 1, 0);
						}
						else {
							ans += (i == start ? 1 : 0) + rec(start, digs + 2, 1);
						}
					}
					else {

							ans += (i == start ? 1 : 0) + rec(start, digs + 1, 1);

					}

					}
				}

			return dp[start][digs][k] = ans;

		}

	}

	private static long rec(int start, int digs, int k) {
		if(digs >= right.length)
			return 0;
		else if(dp[start][digs][k] != -1)
			return dp[start][digs][k];
		else {

			long ans = 0;

			if(digs == right.length-1) {

				if(k == 0) {
					return 1;
				}
				else {
					return 1;
				}

			}

			else {

				for(int i=0; i<=9; i++) {

					if(k == 0) {

						if(i <= right[digs]) {
							ans += (i == start ? 1 : 0) + rec(start, digs + 1, 0);
						}
						else {
							ans += (i == start ? 1 : 0) + rec(start, digs + 2, 1);
						}
					}
					else {

							ans += (i == start ? 1 : 0) + rec(start, digs + 1, 1);

					}

					}
				}

			return dp[start][digs][k] = ans;

		}

	}

}

import java.util.Scanner;

public class Main
{
    static final int size = 20;
    static final long[] pow = new long[size];
    static final long[] dp = new long[size];

    static
    {
        pow[0] = 1;
        for (int i = 1; i < size; i++)
        {
            pow[i] = pow[i-1]*10;
            dp[i] = 9*getPow(i-2);
        }
    }

    static long getPow(int n)
    {
        try {return pow[n];}
        catch (Exception e) {return 1;}
    }

    static int len(long n)
    {
        return String.valueOf(n).length();
    }

    static long f(long n)
    {
        String s = String.valueOf(n);
        int d = s.length();
        int x = s.charAt(0) - '0';
        int y = s.charAt(d-1) - '0';
        long z = d < 3 ? 1 : Long.parseLong(s.substring(1, d-1)) + 1;

        long ans = getPow(d-2)*(x-1);
        if (x <= y) return ans + z;
        else
        {
            if (n % 100 >= 10)
            {
                n = n - 10 + x - y;
                return f(n);
            }
            else return ans;
        }
    }

    static boolean check(long n)
    {
        String s = String.valueOf(n);
        return s.charAt(0) == s.charAt(s.length()-1);
    }

    public static void main(String[] args)
    {
        long a,b;
        Scanner in = new Scanner(System.in);
        a = in.nextLong();
        b = in.nextLong();

        int da = len(a);
        int db = len(b);

        long ans = 0;
        for (int i = da; i < db; i++)
            ans += dp[i];

        ans  = ans - f(a) + f(b);
        if (check(a)) ans++;
        System.out.print(ans);
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
	public void solve(int testNumber, InputReader in, OutputWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
//        out.printLine(go(r));
//        out.printLine(go(l-1));
        out.printLine(go(r) - go(l-1));
	}

    private long go(long r) {
        if (r < 10) return r;
        long res = 0;
        int first = get(r);
        if (r % 100 >= 10) res += 1;
        else if (r % 10 >= first) res += 1;

        res += first - 1;

        int w = get2(r);
        if (w == 2) {
            res += 9;
            return res;
        }
        else if (w == 3) {
            res += 18;
        }
        else {
            long cnt = 1;
            for(int i = 0; i < w-3; i++) {
                 cnt *= 10;
            }
            cnt *= 9;
            res += cnt;
        }
        return res;
    }

    int get(long k) {
        while(k >= 10){
            k /= 10;
        }
        return (int) k;
    }

    int get2(long k) {
        int ans = 0;
        while(k != 0) {
            k/=10;
            ans++;
        }
        return ans;
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

	}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class A {
    static long dp[][][];
    static char[] curNumb;

    public static long getCountWithLenght(int length) {
        if (length == 1) {
            return 9;
        } else
            return 9L * pow10(length - 2);
    }

    public static long pow10(int pow) {
        if (pow <= 0)
            return 1;
        return 10L * pow10(pow - 1);
    }

    public static long solve(int curPos, int addornot, int start) {
        if (curPos == curNumb.length - 1) {
            if (curNumb[curPos] - '0' <= start || addornot == 1) {
                return 1;
            }
            return 0;
        }
        if (dp[curPos][addornot][start] != -1)
            return dp[curPos][addornot][start];
        if (curPos == 0) {
            long res = solve(curPos + 1, 0, curNumb[0] - '0');
            for (char i = (char) (curNumb[0] + 1); i <= '9'; i++) {
                res += solve(curPos + 1, 1, i - '0');
            }
            return dp[curPos][addornot][start] = res;
        } else {
            long res = 0;
            if (addornot == 1) {
                for (int i = 0; i <= 9; i++) {
                    res += solve(curPos + 1, 1, start);
                }
            } else {
                res += solve(curPos + 1, 0, start);
                for (char i = (char) (curNumb[curPos] + 1); i <= '9'; i++) {
                    res += solve(curPos + 1, 1, start);
                }
            }
            return dp[curPos][addornot][start] = res;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] low = sc.next().toCharArray();
        char[] high = sc.next().toCharArray();
        long res = 0;
        long remLow = 0, remHigh = 0;
        if (low.length == 1) {
            remLow = '9' - low[0] + 1;
        } else {
            curNumb = low;
            dp = new long[low.length][2][10];
            for (int i = 0; i < dp.length; i++) {
                for (int j = 0; j < dp[0].length; j++)
                    Arrays.fill(dp[i][j], -1);
            }
            remLow = solve(0, 0, 0);
        }
        if (high.length == 1) {
            remHigh = '9' - high[0] + 1;
        } else {
            curNumb = high;
            dp = new long[high.length][2][10];
            for (int i = 0; i < dp.length; i++) {
                for (int j = 0; j < dp[0].length; j++)
                    Arrays.fill(dp[i][j], -1);
            }
            remHigh = solve(0, 0, 0);
        }
        if (low.length != high.length) {
            for (int i = low.length + 1; i < high.length; i++) {
                res += getCountWithLenght(i);
            }
            res += remLow;
            res += getCountWithLenght(high.length) - remHigh;
        }
        if (high[0] == high[high.length - 1]) {
            res++;
        }
        System.out.println(res);
    }
}

import java.util.Scanner;

public class C_Litter_Elephant_And_Interval {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		long l=input.nextLong(),r=input.nextLong();
		long count1=1,count2=1;
		long l1=l,r1=r;
		while(l1/10>9){
			l1=l1/10;
			count1++;
		}
		l1=l1/10;
		count1++;
		//System.out.println("count1="+count1);
		while(r1/10>9){
			r1=r1/10;
			count2++;
		}
		r1=r1/10;
		count2++;
		//System.out.println("count2="+count2);
		int i;long count=0;long countex=9,countin=9;
		if(l<10)countex=l-1;
		else if(l<100){
			l1=l/10;
			l=l%10;
			//System.out.println("l1="+l1);
			//System.out.println("l="+l);
			if(l1>l)countex=l+8;
			else countex=l1+9;
			if(l1==l)countex--;
		}
		else{
			for(i=1;i<count1-2;i++)countex=countex*10+9;
			countex=countex+9;
			//System.out.println("countex now="+countex);
			//System.out.println("l1="+l1);
			//System.out.println("l%10="+l%10);
			if(l1<=l%10){
				if(l1==l%10)countex--;
				long j=1,k;
				for(k=1;k<count1-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("l1="+l1);
				countex=countex+j*(l1-1);
				//System.out.println("countex now="+countex);
				j=j*10*l1;
				l1=l%j;
				//System.out.println("l1="+l1);
				l1=l1/10;
				//System.out.println("l1="+l1);
				countex=countex+l1+1;
				if(l1==l%10)countex--;
				//System.out.println("countex="+countex);
			}
			else{
				long k,j=1;
				for(k=0;k<count1-2;k++)j=j*10;
				k=(l1-1)*j;
				countex=countex+k;
				for(i=0;i<count1-1;i++)l1=l1*10;
				l=l%l1;
				l=l/10;
				l--;
				countex=countex+l;
				//System.out.println("countex="+countex);
			}
		}

		if(r<10)countin=r-1;
		else if(r<100){
			r1=r/10;
			r=r%10;
			if(r1>r)countin=r+8;
			else countin=r1+9;
			//if(r1==r)countin--;
		}
		else{
			for(i=1;i<count2-2;i++)countin=countin*10+9;
			countin=countin+9;
			//System.out.println("countin now="+countin);
			//System.out.println("r1="+r1);
			//System.out.println("r%10="+r%10);
			if(r1<=r%10){
				long j=1,k;
				for(k=1;k<count2-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("r1="+r1);
				countin=countin+j*(r1-1);
				//System.out.println("countin now="+countin);
				j=j*10*r1;
				r1=r%j;
				//System.out.println("r1="+r1);
				r1=r1/10;
				//System.out.println("r1="+r1);
				countin=countin+r1+1;
				//System.out.println("countin="+countin);
			}
			else{
				long k,j=1;
				for(k=0;k<count2-2;k++)j=j*10;
				k=(r1-1)*j;
				countin=countin+k;
				for(i=0;i<count2-1;i++)r1=r1*10;
				r=r%r1;
				r=r/10;
				r--;
				countin=countin+r;
				//System.out.println("countin="+countin);
			}
		}
		//System.out.println("countex="+countex);
		//System.out.println("countin="+countin);
		count=countin-countex;
		System.out.println(count);
	}
}

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

public class Main
{

	static long pow_10[]=new long[19];

	static long find_upto(long n){

		if(n<=10)
			return n;

		char ch[]=(String.valueOf(n)).toCharArray();

		int len=ch.length;

		long arr[]=new long[len+1];

		for(int i=0;i<len;i++)
			arr[i]=ch[i]-'0';
		long res=9l;

		for(int i=1;i<len-1;i++){
			int digs=len-i-2;
			if(digs<0)
				break;

			res+=(pow_10[digs]*9l);

		}

		res+=(pow_10[len-2]*(arr[0]-1l));

		if(len==2){

			if(arr[0]<=arr[1])
				res++;
			return res;
		}

		long corner=Long.parseLong((String.valueOf(n)).substring(1,len-1));

		if(arr[0]<=arr[len-1])
			corner++;

		res+=corner+1l;

		return res;
	}

    public static void process()throws IOException
    {
    	long l=nl(),r=nl();

    	long res=find_upto(r)-find_upto(l-1);
    	pn(res);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
    	pow_10[0]=1l;
    	for(int i=1;i<=18;i++) pow_10[i]=10l*pow_10[i-1];

        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
		//t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  Main  {

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//ArrayList<test> lis = new ArrayList<test>();
//	static long sum=0;
//	static boolean f=false;
	//static String s[],r="";
//	static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) throws IOException {
   //googlein.txt C-small-attempt0.in
//	Scanner sc =new Scanner(new File("file.txt"));
	 Scanner sc =new Scanner(System.in);
	  //File file = new File("file.txt");
	//	PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
	//	sc.useDelimiter("(\\s)+|[,]");

	  while(sc.hasNext()){
		   //long sum=0;
	//	  int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();

		//String s=sc.next();
		long l=sc.nextLong()-1,r=sc.nextLong(),A=0,B=0;
		String L=String.valueOf(l);
		String R=String.valueOf(r);

		if( l<10000 ){

			for(int i=1;i<=l;i++){String s=String.valueOf(i);  if( s.charAt(0)==s.charAt(s.length()-1)  )A++;  }

		}
		else A=f( L.charAt(0)-'0',L.charAt(L.length()-1)-'0', L.length() ,l) ;

       if( r<10000 ){

			for(int i=1;i<=r;i++){String s=String.valueOf(i);  if( s.charAt(0)==s.charAt(s.length()-1)  )B++;  }

		}
		else B=f( R.charAt(0)-'0',R.charAt(R.length()-1)-'0', R.length() ,r) ;

	//db(A,B);
         System.out.println(B-A);

	  }

}

 static long f(int a,int b,int k,long p){
	long x=108;
	String s=String.valueOf(p);
	//db(a,b,k,p);
	 if( a<=b ){

		 for(int i=4;i<=k;i++){

			if( i==k ){ x+=(a-1)*pow(10,i-2)+Long.parseLong(s.substring(1,s.length()-1)) ; break;  }
		    x+=9*pow(10,i-2);
		 }
	 }
	 else  {
		long e= Long.parseLong(s.substring(1,s.length()-1));
		if(0<e)e--;
		else e=0;

		 for(int i=4;i<=k;i++){
			if( i==k ){ x+=(a-1)*pow(10,i-2)+e ; break;  }
		    x+=9*pow(10,i-2);
		 }
	 }

	 return x;
 }

	// db("Case #"+(k)+": "+c);
	 //	pw.println("Case #"+(k)+": "+c);

	 	//pw.flush();
	 	//pw.close();

    static void db(Object... os){
	         System.err.println(Arrays.deepToString(os));

	}

}

/*class P implements Comparable<P>{
    int v,vv,t;
	P(int v,int vv,int t){
		this.v=v;
	    this.vv=vv;
	    this.t=t;
	}
	  public int compareTo(P x){
          return t-x.t;
	   }

}*/

import java.util.Scanner;

public class A_Little_Elephant_and_Interval {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String left = sc.next();
		String right = sc.next();
		System.out.println(calc(right)-calc(left));
	}

	private static long calc(String s) {
		long res = 0;
		if (s.length() == 1){
			return Integer.parseInt(s);
		}
		if (s.length() == 2){
			res = s.codePointAt(0)-39;;
			if (s.charAt(0) <= s.charAt(1)){
				res ++;
			}
			return res;
		}
		long a = 0;
		if (s.charAt(0) > s.charAt(s.length()-1)){
			a = Long.parseLong(s.substring(0,s.length()-1))-1;
			String t = a+"";
			t += t.charAt(0);
			boolean f = true;
			for (int i = 0; i < t.length(); i++) {
				if (t.charAt(i) !='9'){
					f = false;
					break;
				}
			}
			if (!f) s = t;
		}
		String t = s.substring(1,s.length()-1);
		res += Long.parseLong(t)+1;
		boolean f = false;
		for (int i = 0; i < t.length(); i++) {
			if (t.charAt(i) !='0'){
				f = true;
				break;
			}
		}
		if (f) res++;
//		res += s.codePointAt(0)-48;
			res += (long)(s.codePointAt(0)-49)*Math.pow(10, t.length());
		for (int i = 1; i < t.length(); i++) {
			res += (long)9*Math.pow(10, i);
		}
		res += (long)18;
		return res;
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class LittleElephantandInterval {

	static char[] x, y;
	static long[][][][] dp;

	static long solve(int i, int a, int b, int f) {
		if (i == x.length)
			return f == -1 ? 1 : 0;
		if (dp[i][f][a][b] != -1)
			return dp[i][f][a][b];
		long cnt = 0;
		for (int j = 0; j < 10; j++) {
			if (a == 0 && b == 0) {
				if (j >= x[i] - '0' && j <= y[i] - '0') {
					cnt += solve(i + 1, j > x[i] - '0' ? 1 : 0,
							j < y[i] - '0' ? 1 : 0, i == 0 ? j
									: (i + 1 == x.length && j == f ? -1 : f));
				}
			} else if (a == 0 && b == 1) {
				if (j >= x[i] - '0') {
					cnt += solve(i + 1, j > x[i] - '0' ? 1 : 0, 1, i == 0 ? j
							: (i + 1 == x.length && j == f ? -1 : f));
				}
			} else if (a == 1 && b == 0) {
				if (j <= y[i] - '0')
					cnt += solve(i + 1, 1, j < y[i] - '0' ? 1 : 0, i == 0 ? j
							: (i + 1 == x.length && j == f ? -1 : f));
			} else {
				cnt += solve(i + 1, 1, 1, i == 0 ? j : (i + 1 == x.length
						&& j == f ? -1 : f));
			}
		}
		return dp[i][f][a][b] = cnt;
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		long l = nxtLng();
		long r = nxtLng();
		y = Long.toString(r).toCharArray();
		String tmp = Long.toString(l);
		int flag = y[0] == y[y.length - 1] ? 1 : 0;
		if (l != r && l > 10)
			flag += tmp.charAt(0) == tmp.charAt(tmp.length() - 1) ? 1 : 0;
		while (tmp.length() < y.length)
			tmp = "0" + tmp;
		x = tmp.toCharArray();
		dp = new long[x.length][10][2][2];
		for (long[][][] a : dp)
			for (long[][] b : a)
				for (long[] c : b)
					Arrays.fill(c, -1);
		out.println(solve(0, 0, 0, 0)
				+ (l < 10 ? (r <= 10 ? r - l : 10 - l) : 0) + flag);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class  Little_Elephant_and_Interval
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);

		int t=1;

		while(t-->0)
		{

			String str[]=br.readLine().trim().split(" ");
			BigInteger a=giveme(Long.parseLong(str[1]));

			BigInteger b=giveme(Long.parseLong(str[0])-1);
			BigInteger c=a.add(new BigInteger("-"+b.toString()));
			pw.println(c.toString());
		}
		pw.flush();
	}

	public static BigInteger giveme(long x)
	{
		//double ans=0;
		String s=""+x;
		BigInteger ans = new BigInteger("0");
		if(Long.parseLong(s)<=10)
			return ans=new BigInteger(s);
		char a[]=s.toCharArray();
		int n=s.length();

		for(long i=1;i<=n;i++)
		{
			if(i<n)
			{
				if(i-2<=0)
				{
					ans=ans.add(new BigInteger("9"));
				}
				else
				{
					ans=ans.add(new BigInteger(""+(9*(long)Math.pow(10,i-2))));
					//System.out.print(9*Math.pow(10,i-2)+" ");
				}
			}
			else
			{
				if(n==2)
				{
					ans=ans.add(new BigInteger(""+(x/11)));
					continue;
				}

				long p=Long.parseLong(""+a[0]);
				for(long j=1;j<p;j++)
				{
					ans=ans.add(new BigInteger(""+(long)Math.pow(10,i-2)));
				}

				String g=s.substring(1,n-1);
				ans=ans.add(new BigInteger(""+(Long.parseLong(g)+1)));

				if(Long.parseLong(""+a[0])>Long.parseLong(""+a[n-1]))
					ans=ans.add(new BigInteger("-1"));

			}
			//System.out.println(ans.toString());
		}

		return ans;
	}

}

import java.util.Scanner;

public class prime_less {
    public static void main(String[] args)  throws Exception{
        new prime_less().run(args);

    }
    static long[] store;

    private void run(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        String fir = input.next();
        String sec = input.next();
        store = new long[20];
        store[0] = 9;
        for(int i = 1; i < 20; i++){
            store[i] = (long) (store[i-1]+9*Math.pow(10, i-1));
        }
        System.out.println(calc(sec) + " " +  (calc(fir)-check(fir)));
    }

    private int check(String num){
        int len = num.length();
        if(len == 1)
            return 1;
        int begin = Integer.parseInt(num.substring(0, 1));
        int end = Integer.parseInt(num.substring(len-1, len));
        if(begin == end)
            return 1;
        else
            return 0;
    }
    private long calc(String num){
        int len = num.length();
        if(len == 1)
            return Long.parseLong(num);
        else if(len >= 19){
            return new Long("100000000000000008");
        }
        else{
            int begin = Integer.parseInt(num.substring(0, 1));
            int end = Integer.parseInt(num.substring(len-1, len));
            long between = 0;

            if(len == 2){
                between = 1;
            }
            else{
                between = Long.parseLong(num.substring(1, len-1))+1;
            }
            //System.out.println(store[len-2]);
            //System.out.println(begin + " " + between +" " + end);
            if(end >= begin){
                return (long) (between+(begin-1)*Math.pow(10, len-2) + store[len-2]);
            }
            else{
                return (long) (between-1 + (begin-1)*Math.pow(10, len-2) + store[len-2]);
            }

        }
    }

}

import java.util.Scanner;

public class A_Little_Elephant_and_Interval {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String left = sc.next();
        String right = sc.next();
        System.out.println(calc(right)-calc(left));

    }
    private static long calc(String s) {
        long res = 0;
        if (s.length() == 1){
            return Integer.parseInt(s);
        }
        if (s.length() == 2){
            res = s.codePointAt(0)-39;;
            if (s.charAt(0) <= s.charAt(1)){
                res ++;
            }
            return res;
        }
        long a = 0;
        if (s.charAt(0) > s.charAt(s.length()-1)){
            a = Long.parseLong(s.substring(0,s.length()-1))-1;
            String t = a+"";
            t += t.charAt(0);
            boolean f = true;
            for (int i = 0; i < t.length(); i++) {
                if (t.charAt(i) !='9'){
                    f = false;
                    break;
                }
            }
            if (!f) s = t;
        }
        String t = s.substring(1,s.length()-1);
        res += Long.parseLong(t)+1;
        res += (s.codePointAt(0)-49)*Math.pow(10, t.length());
        for (int i = 1; i < t.length(); i++) {
            res += 9*Math.pow(10, i);
        }
        res += 18;
        return res;
    }

}
/*
10001 10000002
Answer
999001
*/

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        long l = in.nextLong();
        long r = in.nextLong();
        String s;
        while (true) {
            s = l + "";
            if (s.charAt(0) == s.charAt(s.length() - 1))
                break;
            l++;
        }
        while (true) {
            s = r + "";
            if (s.charAt(0) == s.charAt(s.length() - 1))
                break;
            r--;
        }
        if (l > r)
            System.out.println(0);
        else if (l == r)
            System.out.println(1);
        else if (l <= 10 && r <= 10) {
            long res = r - l + 1;
            if (r == 10 && l == 10)
                res--;
            if (r == 10)
                res--;
            System.out.println(res);
        } else {
            long res = 0;
            boolean t = false;
            while (l < 11) {
                l++;
                res++;
                t = true;
            }
            if (t)
                res--;
            String[] ni = new String[19];
            String[] z = new String[19];
            ni[0] = "";
            z[0] = "";
            for (int i = 1; i < ni.length; i++)
                ni[i] = ni[i - 1] + "9";
            for (int i = 1; i < ni.length; i++)
                z[i] = z[i - 1] + "0";
            s = l + "";
            int len = s.length() - 2;
            long cur = l;
            char d = s.charAt(0);
            long nxt;
            for (int i = len;; i++) {
                nxt = Long.parseLong(d + ni[len] + d);
                if (nxt <= r) {
                    if (len == 0)
                        res++;
                    else
                        res += Long.parseLong(ni[len]) + 1;
                    if (d == '9') {
                        len++;
                        d = '1';
                    } else
                        d++;
                    cur = Long.parseLong(d + z[len] + d);
                } else {
                    String s1 = r + "";
                    String s2 = cur + "";
                    String ss1 = s1.substring(1, s1.length() - 1);
                    String ss2 = s2.substring(1, s2.length() - 1);
                    long a1 = 0, a2 = 0;
                    if (ss1.length() != 0)
                        a1 = Long.parseLong(ss1);
                    if (ss2.length() != 0)
                        a2 = Long.parseLong(ss2);
                    if (a1 != a2)
                        res += a1 - a2 + 1;
                    break;
                }
            }
            System.out.println(res);
        }
    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer st;

        public InputReader() throws IOException {
            in = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer(in.readLine());
        }

        public String next() throws IOException {
            while (!st.hasMoreElements())
                st = new StringTokenizer(in.readLine());
            return st.nextToken();
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }
    }
}

import java.io.*;
import java.util.*;
public class icpc
{
    public static void main(String[] args) throws IOException
    {
        Reader in = new Reader();
        //BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long l = in.nextLong();
        long r = in.nextLong();
        System.out.println(giveAns(r) - giveAns(l - 1));
    }
    public static long giveAns(long x)
    {
        int numOfDigits = Long.toString(x).length();
        long ans = 0L;
        for (int i=2;i<numOfDigits;i++)
            ans += 9L * (long)Math.pow(10, i - 2);
        if (numOfDigits > 1)
            ans += 9;
        if (numOfDigits == 1)
            ans += x;
        else
        {
            int firstDigit = Long.toString(x).charAt(0) - '0';
            int lastDigit = Long.toString(x).charAt(numOfDigits - 1) - '0';
            ans += (firstDigit - 1) * (long)Math.pow(10, numOfDigits - 2);
            long val = 1L;
            if (firstDigit <= lastDigit)
            {
                String s = Long.toString(x);
                for (int j=1;j<numOfDigits - 1;j++)
                {
                    int digit = s.charAt(j) - '0';
                    val *= (digit + 1);
                }
                ans += val;
            }
        }
        return ans;
    }
}
class DSU
{
    int[] parent;
    int[] size;
    //Pass number of total nodes as parameter to the constructor
    DSU(int n)
    {
        this.parent = new int[n];
        this.size = new int[n];
        Arrays.fill(parent, -1);
    }

    public void makeSet(int v)
    {
        parent[v] = v;
        size[v] = 1;
    }

    public int findSet(int v)
    {
        if (v == parent[v]) return v;
        return parent[v] = findSet(parent[v]);
    }

    public void unionSets(int a, int b)
    {
        a = findSet(a);
        b = findSet(b);
        if (a != b)
        {
            if (size[a] < size[b])
            {
                int temp = a;
                a = b;
                b = temp;
            }
            parent[b] = a;
            size[a] += size[b];
        }
    }
}
class FastFourierTransform
{
    private void fft(double[] a, double[] b, boolean invert)
    {
        int count = a.length;
        for (int i = 1, j = 0; i < count; i++)
        {
            int bit = count >> 1;
            for (; j >= bit; bit >>= 1)
                j -= bit;
            j += bit;
            if (i < j)
            {
                double temp = a[i];
                a[i] = a[j];
                a[j] = temp;
                temp = b[i];
                b[i] = b[j];
                b[j] = temp;
            }
        }
        for (int len = 2; len <= count; len <<= 1)
        {
            int halfLen = len >> 1;
            double angle = 2 * Math.PI / len;
            if (invert)
                angle = -angle;
            double wLenA = Math.cos(angle);
            double wLenB = Math.sin(angle);
            for (int i = 0; i < count; i += len)
            {
                double wA = 1;
                double wB = 0;
                for (int j = 0; j < halfLen; j++)
                {
                    double uA = a[i + j];
                    double uB = b[i + j];
                    double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
                    double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
                    a[i + j] = uA + vA;
                    b[i + j] = uB + vB;
                    a[i + j + halfLen] = uA - vA;
                    b[i + j + halfLen] = uB - vB;
                    double nextWA = wA * wLenA - wB * wLenB;
                    wB = wA * wLenB + wB * wLenA;
                    wA = nextWA;
                }
            }
        }
        if (invert)
        {
            for (int i = 0; i < count; i++)
            {
                a[i] /= count;
                b[i] /= count;
            }
        }
    }

    public long[] multiply(long[] a, long[] b)
    {
        int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;
        resultSize = Math.max(resultSize, 1);
        double[] aReal = new double[resultSize];
        double[] aImaginary = new double[resultSize];
        double[] bReal = new double[resultSize];
        double[] bImaginary = new double[resultSize];
        for (int i = 0; i < a.length; i++)
            aReal[i] = a[i];
        for (int i = 0; i < b.length; i++)
            bReal[i] = b[i];
        fft(aReal, aImaginary, false);
        fft(bReal, bImaginary, false);
        for (int i = 0; i < resultSize; i++)
        {
            double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];
            aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];
            aReal[i] = real;
        }
        fft(aReal, aImaginary, true);
        long[] result = new long[resultSize];
        for (int i = 0; i < resultSize; i++)
            result[i] = Math.round(aReal[i]);
        return result;
    }
}
class NumberTheory
{
    public boolean isPrime(long n)
    {
        if(n < 2)
            return false;
        for(long x = 2;x * x <= n;x++)
        {
            if(n % x == 0)
                return false;
        }
        return true;
    }
    public ArrayList<Long> primeFactorisation(long n)
    {
        ArrayList<Long> f = new ArrayList<>();
        for(long x=2;x * x <= n;x++)
        {
            while(n % x == 0)
            {
                f.add(x);
                n /= x;
            }
        }
        if(n > 1)
            f.add(n);
        return f;
    }
    public int[] sieveOfEratosthenes(int n)
    {
        //Returns an array with the smallest prime factor for each number and primes marked as 0
        int[] sieve = new int[n + 1];
        for(int x=2;x * x <= n;x++)
        {
            if(sieve[x] != 0)
                continue;
            for(int u=x*x;u<=n;u+=x)
            {
                if(sieve[u] == 0)
                {
                    sieve[u] = x;
                }
            }
        }
        return sieve;
    }
    public long gcd(long a, long b)
    {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }
    public long phi(long n)
    {
        double result = n;

        for(long p=2;p*p<=n;p++)
        {
            if(n % p == 0)
            {
                while (n % p == 0)
                    n /= p;
                result *= (1.0 - (1.0 / (double)p));
            }
        }
        if(n > 1)
            result *= (1.0 - (1.0 / (double)n));
        return (long)result;
    }
    public Name extendedEuclid(long a, long b)
    {
        if(b == 0)
            return new Name(a, 1, 0);
        Name n1 = extendedEuclid(b, a % b);
        Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);
        return n2;
    }
    public long modularExponentiation(long a, long b, long n)
    {
        long d = 1L;
        String bString = Long.toBinaryString(b);
        for(int i=0;i<bString.length();i++)
        {
            d = (d * d) % n;
            if(bString.charAt(i) == '1')
                d = (d * a) % n;
        }
        return d;
    }
}
class Name
{
    long d;
    long x;
    long y;

    public Name(long d, long x, long y)
    {
        this.d = d;
        this.x = x;
        this.y = y;
    }
}
class SuffixArray
{
    int ALPHABET_SZ = 256, N;
    int[] T, lcp, sa, sa2, rank, tmp, c;

    public SuffixArray(String str)
    {
        this(toIntArray(str));
    }

    private static int[] toIntArray(String s)
    {
        int[] text = new int[s.length()];
        for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);
        return text;
    }

    public SuffixArray(int[] text)
    {
        T = text;
        N = text.length;
        sa = new int[N];
        sa2 = new int[N];
        rank = new int[N];
        c = new int[Math.max(ALPHABET_SZ, N)];
        construct();
        kasai();
    }

    private void construct()
    {
        int i, p, r;
        for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;
        for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
        for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;
        for (p = 1; p < N; p <<= 1)
        {
            for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;
            for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;
            Arrays.fill(c, 0, ALPHABET_SZ, 0);
            for (i = 0; i < N; ++i) c[rank[i]]++;
            for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
            for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];
            for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)
            {
                if (!(rank[sa[i - 1]] == rank[sa[i]]
                        && sa[i - 1] + p < N
                        && sa[i] + p < N
                        && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;
                sa2[sa[i]] = r;
            }
            tmp = rank;
            rank = sa2;
            sa2 = tmp;
            if (r == N - 1) break;
            ALPHABET_SZ = r + 1;
        }
    }

    private void kasai()
    {
        lcp = new int[N];
        int[] inv = new int[N];
        for (int i = 0; i < N; i++) inv[sa[i]] = i;
        for (int i = 0, len = 0; i < N; i++)
        {
            if (inv[i] > 0)
            {
                int k = sa[inv[i] - 1];
                while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;
                lcp[inv[i] - 1] = len;
                if (len > 0) len--;
            }
        }
    }
}
class ZAlgorithm
{
    public int[] calculateZ(char input[])
    {
        int Z[] = new int[input.length];
        int left = 0;
        int right = 0;
        for(int k = 1; k < input.length; k++) {
            if(k > right) {
                left = right = k;
                while(right < input.length && input[right] == input[right - left]) {
                    right++;
                }
                Z[k] = right - left;
                right--;
            } else {
                //we are operating inside box
                int k1 = k - left;
                //if value does not stretches till right bound then just copy it.
                if(Z[k1] < right - k + 1) {
                    Z[k] = Z[k1];
                } else { //otherwise try to see if there are more matches.
                    left = k;
                    while(right < input.length && input[right] == input[right - left]) {
                        right++;
                    }
                    Z[k] = right - left;
                    right--;
                }
            }
        }
        return Z;
    }
    public ArrayList<Integer> matchPattern(char text[], char pattern[])
    {
        char newString[] = new char[text.length + pattern.length + 1];
        int i = 0;
        for(char ch : pattern) {
            newString[i] = ch;
            i++;
        }
        newString[i] = '$';
        i++;
        for(char ch : text) {
            newString[i] = ch;
            i++;
        }
        ArrayList<Integer> result = new ArrayList<>();
        int Z[] = calculateZ(newString);

        for(i = 0; i < Z.length ; i++) {
            if(Z[i] == pattern.length) {
                result.add(i - pattern.length - 1);
            }
        }
        return result;
    }
}
class KMPAlgorithm
{
    public int[] computeTemporalArray(char[] pattern)
    {
        int[] lps = new int[pattern.length];

        int index = 0;
        for(int i=1;i<pattern.length;)
        {
            if(pattern[i] == pattern[index])
            {
                lps[i] = index + 1;
                index++;
                i++;
            }
            else
            {
                if(index != 0)
                {
                    index = lps[index - 1];
                }
                else
                {
                    lps[i] = 0;
                    i++;
                }
            }
        }
        return lps;
    }

    public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)
    {
        int[] lps = computeTemporalArray(pattern);

        int j = 0;
        int i = 0;
        int n = text.length;
        int m = pattern.length;
        ArrayList<Integer> indices = new ArrayList<>();
        while(i < n)
        {
            if(pattern[j] == text[i])
            {
                i++;
                j++;
            }
            if(j == m)
            {
                indices.add(i - j);
                j = lps[j - 1];
            }
            else if(i < n && pattern[j] != text[i])
            {
                if(j != 0)
                    j = lps[j - 1];
                else
                    i = i + 1;
            }
        }
        return indices;
    }
}
class Hashing
{
    public long[] computePowers(long p, int n, long m)
    {
        long[] powers = new long[n];
        powers[0] = 1;
        for(int i=1;i<n;i++)
        {
            powers[i] = (powers[i - 1] * p) % m;
        }
        return powers;
    }
    public long computeHash(String s)
    {
        long p = 31;
        long m = 1_000_000_009;
        long hashValue = 0L;
        long[] powers = computePowers(p, s.length(), m);
        for(int i=0;i<s.length();i++)
        {
            char ch = s.charAt(i);
            hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;
        }
        return hashValue;
    }
}
class BasicFunctions
{
    public long min(long[] A)
    {
        long min = Long.MAX_VALUE;
        for(int i=0;i<A.length;i++)
        {
            min = Math.min(min, A[i]);
        }
        return min;
    }
    public long max(long[] A)
    {
        long max = Long.MAX_VALUE;
        for(int i=0;i<A.length;i++)
        {
            max = Math.max(max, A[i]);
        }
        return max;
    }
}
class MergeSortInt
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

}
class MergeSortLong
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(long arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
}
class Node
{

    int x;
    int y;

    public Node(int x, int y)
    {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object ob)
    {
        if(ob == null)
            return false;
        if(!(ob instanceof Node))
            return false;
        if(ob == this)
            return true;
        Node obj = (Node)ob;
        if(this.x == obj.x && this.y == obj.y)
            return true;
        return false;
    }

    @Override
    public int hashCode()
    {
        return (int)this.x;
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}
class FenwickTree
{
    public void update(long[] fenwickTree,long delta,int index)
    {
        index += 1;
        while(index < fenwickTree.length)
        {
            fenwickTree[index] += delta;
            index = index + (index & (-index));
        }
    }
    public long prefixSum(long[] fenwickTree,int index)
    {
        long sum = 0L;
        index += 1;
        while(index > 0)
        {
            sum += fenwickTree[index];
            index -= (index & (-index));
        }
        return sum;
    }
}
class SegmentTree
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }
    public int[] createSegmentTree(int[] input)
    {
        int np2 = nextPowerOfTwo(input.length);
        int[] segmentTree = new int[np2 * 2 - 1];

        for(int i=0;i<segmentTree.length;i++)
            segmentTree[i] = Integer.MIN_VALUE;

        constructSegmentTree(segmentTree,input,0,input.length-1,0);
        return segmentTree;

    }
    private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/ 2;
        constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);
        constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);
        segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);
    }
    public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)
    {
        return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);
    }
    private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)
    {
        if(qlow <= low && qhigh >= high){
            return segmentTree[pos];
        }
        if(qlow > high || qhigh < low){
            return Integer.MIN_VALUE;
        }
        int mid = (low+high)/2;
        return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),
                rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));
    }
}
class Trie
{

    private class TrieNode
    {
        Map<Character, TrieNode> children;
        boolean endOfWord;
        public TrieNode()
        {
            children = new HashMap<>();
            endOfWord = false;
        }
    }

    private final TrieNode root;
    public Trie()
    {
        root = new TrieNode();
    }

    public void insert(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                node = new TrieNode();
                current.children.put(ch, node);
            }
            current = node;
        }
        current.endOfWord = true;
    }

    public boolean search(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                return false;
            }
            current = node;
        }
        return current.endOfWord;
    }

    public void delete(String word)
    {
        delete(root, word, 0);
    }

    private boolean delete(TrieNode current, String word, int index)
    {
        if (index == word.length())
        {
            if (!current.endOfWord)
            {
                return false;
            }
            current.endOfWord = false;
            return current.children.size() == 0;
        }
        char ch = word.charAt(index);
        TrieNode node = current.children.get(ch);
        if (node == null)
        {
            return false;
        }
        boolean shouldDeleteCurrentNode = delete(node, word, index + 1);

        if (shouldDeleteCurrentNode)
        {
            current.children.remove(ch);
            return current.children.size() == 0;
        }
        return false;
    }
}
class SegmentTreeLazy
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public int[] createSegmentTree(int input[])
    {
        int nextPowOfTwo = nextPowerOfTwo(input.length);
        int segmentTree[] = new int[nextPowOfTwo*2 -1];

        for(int i=0; i < segmentTree.length; i++){
            segmentTree[i] = Integer.MAX_VALUE;
        }
        constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);
        return segmentTree;
    }

    private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/2;
        constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);
        constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);
        segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);
    }

    public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)
    {
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);
    }

    private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)
    {
        if(low > high)
        {
            return;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(startRange > high || endRange < low)
        {
            return;
        }

        if(startRange <= low && endRange >= high)
        {
            segmentTree[pos] += delta;
            if(low != high) {
                lazy[2*pos + 1] += delta;
                lazy[2*pos + 2] += delta;
            }
            return;
        }

        int mid = (low + high)/2;
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);
        segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);
    }

    public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)
    {
        return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);
    }

    private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)
    {
        if(low > high)
        {
            return Integer.MAX_VALUE;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(qlow > high || qhigh < low)
        {
            return Integer.MAX_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return segmentTree[pos];
        }

        int mid = (low+high)/2;
        return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy,  qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	long getAns(long r) {
		if (r < 10)
			return r;
		if (r < 100) {
			long ret = 9;
			for (int i = 1; i < 10; i++)
				if (i * 10 + i <= r)
					ret++;
			return ret;
		}
		int len = String.valueOf(r).length();
		long ret = 9;
		long x = 9;
		for (int i = 0; i < len - 2; i++) {
			ret += x;
			x *= 10;
		}
		x /= 9;
		for (int i = 1; i < 10; i++) {
			if (r / x / 10 == i) {
				ret += r % (x * 10) / 10;
				if (r % 10 >= i)
					ret++;
				break;
			} else {
				ret += x / 10;
			}
		}
		return ret;
	}

	boolean isLuck(long x) {
		return String.valueOf(x).charAt(0) == (x % 10 + '0');
	}

	private void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		out.println(getAns(r) - getAns(l) + (isLuck(l) ? 1 : 0));
	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import java.util.Scanner;

public class CF204A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long L = in.nextLong();
        long R = in.nextLong();
        String LS = new Long(L).toString();
        String RS = new Long(R).toString();

        long ans = 0;
        for(int d=1; d<=9; d++) {
            if(L <= d && d<=R) ans++;
        }

        for(int d=1; d<=9; d++) {
            for(int len = 1; len<=17; len++) {
                long st = d + (long)(Math.pow(10,len))*d;
                long ed = st + (long)Math.pow(10, len)-10;
                if(ed < L || st > R) continue;

                st = (st-d)/10;
                ed = (ed-d)/10;
                long myL = (L-d+d-1)/10;
                long myR = (R-d+d-1)/10;

                st = Math.max(st, myL);
                ed = Math.min(ed, myR);
            //    System.out.println(st+" "+ed);

                ans += ed-st+1;
            }
        }
        System.out.println(ans);
    }
}

import java.util.Scanner;

public class Main
{
    static final int size = 20;
    static final long[] pow = new long[size];
    static final long[] dp = new long[size];

    static
    {
        pow[0] = 1;
        for (int i = 1; i < size; i++)
        {
            pow[i] = pow[i-1]*10;
            dp[i] = 9*getPow(i-2);
        }
    }

    static long getPow(int n)
    {
        try {return pow[n];}
        catch (Exception e) {return 1;}
    }

    static int len(long n)
    {
        return String.valueOf(n).length();
    }

    static long f(long n)
    {
        String s = String.valueOf(n);
        int d = s.length();
        int x = s.charAt(0) - '0';
        int y = s.charAt(d-1) - '0';
        long z = d < 3 ? 1 : Long.parseLong(s.substring(1, d-1)) + 1;

        long ans = getPow(d-2)*(x-1);
        if (x > y) return ans;
        else return ans + z;
    }

    static boolean check(long n)
    {
        String s = String.valueOf(n);
        return s.charAt(0) == s.charAt(s.length()-1);
    }

    public static void main(String[] args)
    {
        long a,b;
        Scanner in = new Scanner(System.in);
        a = in.nextLong();
        b = in.nextLong();

        int da = len(a);
        int db = len(b);

        long ans = 0;
        for (int i = da; i < db; i++)
            ans += dp[i];

        ans  = ans - f(a) + f(b);
        if (check(a)) ans++;
        System.out.print(ans);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_204A solver = new CF_204A();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_204A {
        long[] tenPower = power(18);

        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            long l = in.l(), r = in.l();
            out.println(cal(r) - cal(l - 1));
            //cal(1010);
        }

        long cal(long mx) {
            if (mx < 10) return mx;
            long ten = 1, ans = 0;
            int digits = 1;
            while (ten <= mx) {
                for (int i = 1; i <= 9 && i * ten <= mx; ++i) {
                    if ((i + 1) * ten <= mx) {
                        if (ten == 1)
                            ans++;
                        else
                            ans += tenPower[digits - 2];
                    }
                    else if (i * ten + i <= mx) {
                        ans += 1 + (mx / 10 - i * (ten / 10));
                        if (i > mx % 10) ans--;
                    }
                }

                ten *= 10;
                digits++;
            }
            return ans;
        }

        long[] power(int max) {
            long[] rs = new long[max + 1];
            rs[0] = 1;
            for (int i = 1; i <= max; ++i)
                rs[i] = rs[i - 1] * 10;
            return rs;
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            long l() {
                return in.nextLong();
            }

        }

    }
}

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

public class CF204A {
    public static void main(String[] args) {
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        Application solver = new Application();
        solver.solve(System.in, out);

        out.close();
    }
}

class Application {
    long count(long number) {
        String s = number + "";

        if (s.length() == 1) {
            return number;
        }
        else if (s.length() == 2) {
            return number / 11 + 9;
        }
        else {
            long mid = Long.parseLong(s.substring(1, s.length() - 1));
            long first = Long.parseLong(s.charAt(0) + "");
            long last = Long.parseLong(s.charAt(s.length()-1) + "");

            long c = 0;
            for (int i = 1; i <= s.length() - 1; i++) {
                if (i == 1 || i == 2) {
                    c += 9;
                }
                else {
                    c += Math.pow(10, i-2)*9;
                }
            }

            c += Math.pow(10, s.length()-2)*(first-1);

            if (first < last) {
                c += mid+1;
            }
            else {
                c += mid;
            }
            return c;
        }
    }

    public void solve(InputStream in, PrintWriter out) {
        Scanner scanner = new Scanner(in);
        long a = scanner.nextLong();
        long b = scanner.nextLong();

        //out.println(a + " " + count(a));
        //out.println(b + " " + count(b));
        out.println(count(b) - count(a-1));
    }
}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        String left = jin.next();
        String right = jin.next();

        long count = 0;
        for(int i = left.length() + 1; i <= right.length(); i++) {
            if(i > 2) {
                count += 9 * Math.pow(10, i - 2);
            } else {
                count += 9;
            }
        }

        long cl = compute(left);
        long cr = compute(right);

        if(right.charAt(0) == right.charAt(right.length() - 1))
            cr--;

        jout.println(count + cl - cr);
    }

    private long compute(String left) {
        int val = (left.charAt(0) - '0') + 1;
        int len = Math.max(0, left.length()-2);

        long tot = (long) Math.pow(10, len);
        long result = (9 - val + 1) * tot;
        if(left.charAt(0) == left.charAt(left.length() - 1)) {
            if(left.length() > 1) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
            } else {
                result++;
            }
        } else {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
                if (left.charAt(left.length() - 1) > left.charAt(0))
                    result--;
            } else if(left.length() > 1) {
                if (left.charAt(left.length() - 1) < left.charAt(0))
                    result++;
            } else {
                result++;
            }
        }
        return result;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class P204A {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(in, out);
		out.close();
	}

	static class Task {
		public void solve(InputReader in, PrintWriter out) {
			long l = in.nextLong();
			long r = in.nextLong();
			String sr = String.valueOf(r);
			int lenr = sr.length();
			long total = 0;
			if (l < 10 && r < 10) {
				out.println(r - l + 1);
				return;
			} else if (l < 10/*&&r>=10*/) {
				total += 11 - l;
				l = 10;
			}
			StringBuilder sl = new StringBuilder(String.valueOf(l));
			char ls = sl.charAt(0);
			char le = sl.charAt(sl.length() - 1);
			if (ls >= le) {
				sl.setCharAt(sl.length() - 1, ls);
			} else {
				sl.setCharAt(0, (char) (ls + 1));
				for (int i = 1; i + 1 < sl.length(); i++)
					sl.setCharAt(i, '0');
				sl.setCharAt(sl.length() - 1, (char) (1 + ls));
			}
			while (true) {
				long add = (long) (Math.pow(10, sl.length() - 2));
				if (sl.length() < lenr) {
					if (sl.length() > 2 && sl.charAt(1) != '0') {
						total += (9 - sl.charAt(0) + '0') * add
								+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
					} else {
						total += (9 - sl.charAt(0) + '0' + 1) * add;
					}
				} else {
					if (sl.charAt(0) == sr.charAt(0)) {
						long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
								- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
						if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
							diff--;
						}
						total += diff;
					} else {
						int k = sr.charAt(0) - '0' - 1;
						if (sl.length() > 2 && sl.charAt(1) != '0') {
							total += (k - sl.charAt(0) + '0') * add
									+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
						} else {
							total += (k - sl.charAt(0) + '0' + 1) * add;
						}
						sl = new StringBuilder(
								String.valueOf((long) ((k + 1) * Math.pow(10, sl.length() - 1))) + (k + 1));
						if (Long.valueOf(sl.toString()) <= Long.valueOf(r)) {
							long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
									- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
							if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
								diff--;
							}
							total += diff;
						}

					}
					break;
				}
				sl = new StringBuilder(String.valueOf((long) (1 + Math.pow(10, sl.length()))));
			}
			out.println(total);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
}

import java.util.*;
import java.io.*;
public class LittleElephantAndInterval
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);

		long l = in.nextLong();
		long r = in.nextLong();

		long result = 0;
		for(int x = 0; x < 17; x++)
		{
			for(int y = 1; y <= 9; y++)
			{
				long low = (long)Math.pow(10, x) * y;

				if(x > 0)
				{
					low += y;
				}

				long high = low;
				if(x > 1)
				{
					high += (((long)Math.pow(10, x - 1) - 1) * 10);
				}

				if(low >= l && high <= r)
				{
					result += (high / 10) - (low / 10) + 1;
				}
				else if(low < l && high > r)
				{
					result += (r / 10) - (l / 10) + 1;

					if(r % 10 < y)
					{
						result--;
					}
					if(l % 10 > y)
					{
						result--;
					}
				}
				else if(low < l && high > l)
				{
					result += (high / 10) - (l / 10) + 1;

					if(l % 10 > y)
					{
						result--;
					}
				}
				else if(low < r && high > r)
				{
					result += (r / 10) - (low / 10) + 1;

					if(r % 10 < y)
					{
						result--;
					}
				}
			}
		}

		System.out.println(result);
	}
}

import java.util.*;
import static java.lang.Math.*;
public class ProblemC {
    void run() {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        p("%s\n", countNumbers(r) - countNumbers(l-1));

    }

    long countNumbers(long bound) {
      long total = 0;
      if (bound < 0) {
        return 0;
      } else if (bound <= 100) {
        for (int i=1; i<=bound; i++) {
          String s = Integer.toString(i);
          if (s.charAt(0) == s.charAt(s.length()-1)) {
            total += 1;
          }
        }
        return total;
      }

      String s = Long.toString(bound);
      int len = s.length();

      total += countAllDigits(len);

      int firstDigit = Integer.parseInt(s.substring(0, 1), 10);
      int lastDigit = Integer.parseInt(s.substring(len-1, len), 10);

    total += (firstDigit - 1) * Math.pow(10, len - 2);

      long middle = Long.parseLong(s.substring(1, len-1), 10);
      d("Middle is %s", middle);
      if (firstDigit <= lastDigit) {
        total += middle + 1;
      } else {
        total += middle;
      }

      return total;
    }

    long countAllDigits(int len) {

      long total = 0;
      for (int i=1; i<len; i++) {
        total += (long) 9 * Math.pow(10L, Long.valueOf(Math.max(i-2, 0)));
      }
      d("Count all digits for length=%s, out=%s", len, total);
      return total;
    }

    boolean debug = false;
    void p(String f, Object...params) {
        System.out.printf(f, params);
    }
    void d(Object...params) {
        if (debug) {
            p("DEBUG: %s\n", Arrays.deepToString(params));
        }
    }
    public ProblemC(String[] args) {
        if (args.length > 0 && args[0].equals("debug")) {
            debug = true;
        }
    }
    public static void main(String[] args) {
        new ProblemC(args).run();
    }
}

import java.util.*;

public class Problem204A {

	public static double CalculateSymetrical(double limit) {
		if(limit < 10) {
			return limit;
		}
		double modulus = limit % 10;
		double numbers = (limit / 10) + 9;
		while(limit >= 10) limit /= 10;
		if(limit > modulus) numbers--;
		return numbers;

	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double lowerLimit = sc.nextDouble();
		double upperLimit = sc.nextDouble();

		System.out.println(String.format("%.0f", Math.ceil(CalculateSymetrical(upperLimit) - CalculateSymetrical(lowerLimit - 1))));

	}
}

import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    long cal(long c) {
        String s = c+"";
        int l = s.length();
        long r = min(9, c);
        long t = 1;
        for (int i=2; i<l; i++) {
            r += 9*t;
            t *= 10;
        }
        if (l>1) {
            int d = s.charAt(0)-'0'-(s.charAt(0)>s.charAt(l-1)?1:0);
            if (l==2)
                r += d;
            else
                r += d*(1+Integer.parseInt(s.substring(1, l-1)));
        }
        return r;
    }

    public A() throws Exception {
        // long l = in.nextLong();
        // long r = in.nextLong();
        // System.out.println(cal(r)-cal(l-1));

        for (int i=0; i<45; i++) {
            debug(i, cal(i));
        }
    }

    Scanner in = new Scanner(System.in);
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}

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

public class Main
{

	static long pow_10[]=new long[19];

	static long find_upto(long n){

		if(n<=10)
			return n;

		char ch[]=(String.valueOf(n)).toCharArray();

		int len=ch.length;

		long arr[]=new long[len+1];

		for(int i=0;i<len;i++)
			arr[i]=ch[i]-'0';
		long res=9l;

		for(int i=1;i<len-1;i++){
			int digs=len-i-2;
			if(digs<0)
				break;

			res+=(pow_10[digs]*9l);

		}

		res+=(pow_10[len-2]*(arr[0]-1l));

		if(len==2){
			if(arr[0]<arr[1])
				res++;//System.out.println("res "+res);
			return res;
		}

		long corner=Long.parseLong((String.valueOf(n)).substring(1,len-1));

		// if(arr[len-1]>arr[0])
		// 	corner--;

		res+=corner+1;//System.out.println("res "+res);

		return res;
	}

    public static void process()throws IOException
    {
    	long l=nl(),r=nl();

    	long res=find_upto(r)-find_upto(l-1);
    	pn(res);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
    	pow_10[0]=1l;
    	for(int i=1;i<=18;i++) pow_10[i]=10l*pow_10[i-1];

        out = new PrintWriter(System.out);
        sc=new AnotherReader();
        boolean oj = true;

    	oj = System.getProperty("ONLINE_JUDGE") != null;
    	if(!oj) sc=new AnotherReader(100);

        long s = System.currentTimeMillis();
        int t=1;
		//t=ni();
        while(t-->0)
            process();
        out.flush();
        if(!oj)
            System.out.println(System.currentTimeMillis()-s+"ms");
        System.out.close();
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);System.out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}
    static boolean multipleTC=false;
    static long mod=(long)1e9+7l;

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

import java.util.*;
import static java.lang.Math.*;
public class ProblemC {
    void run() {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        p("%s\n", countNumbers(r) - countNumbers(l-1));

    }

    long countNumbers(long bound) {
    	long total = 0;
    	if (bound < 0) {
    		return 0;
    	} else if (bound <= 100) {
    		for (int i=1; i<=bound; i++) {
    			String s = Integer.toString(i);
    			if (s.charAt(0) == s.charAt(s.length()-1)) {
    				total += 1;
    			}
    		}
    		return total;
    	}

    	String s = Long.toString(bound);
    	int len = s.length();

    	total += countAllDigits(len);

    	int firstDigit = Integer.parseInt(s.substring(0, 1), 10);
    	int lastDigit = Integer.parseInt(s.substring(len-1, len), 10);

		total += (firstDigit - 1) * Math.pow(10, Math.max(len - 2, 0));

    	long middle = Long.parseLong(s.substring(1, len-1), 10);
    	if (firstDigit <= lastDigit) {
    		total += middle + 1;
    	} else {
    		total += middle;
    	}

    	return total;
    }

    long countAllDigits(int len) {

    	long total = 0;
    	for (int i=1; i<len; i++) {
    		total += 9 * Math.pow(10, Math.max(i-2, 0));
    	}
    	d("Count all digits for length=%s, out=%s", len, total);
    	return total;
    }

    boolean debug = false;
    void p(String f, Object...params) {
        System.out.printf(f, params);
    }
    void d(Object...params) {
        if (debug) {
            p("DEBUG: %s\n", Arrays.deepToString(params));
        }
    }
    public ProblemC(String[] args) {
        if (args.length > 0 && args[0].equals("debug")) {
            debug = true;
        }
    }
    public static void main(String[] args) {
        new ProblemC(args).run();
    }
}

import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		in.close();
		out.close();
	}

	long getAns(long r) {
		if (r < 10)
			return r;
		if (r < 100) {
			long ret = 9;
			for (int i = 1; i < 10; i++)
				if (i * 10 + i <= r)
					ret++;
			return ret;
		}
		int len = String.valueOf(r).length();
		long ret = 9;
		int x = 9;
		for (int i = 0; i < len - 2; i++) {
			ret += x;
			x *= 10;
		}
		x /= 9;
		for (int i = 1; i < 10; i++) {
			if (r / x / 10 == i) {
				ret += r % (x * 10) / 10;
				if (r % 10 >= i)
					ret++;
				break;
			} else {
				ret += x / 10;
			}
		}
		return ret;
	}

	boolean isLuck(long x) {
		return String.valueOf(x).charAt(0) == (x % 10 + '0');
	}

	private void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		out.println(getAns(r) - getAns(l) + (isLuck(l) ? 1 : 0));
	}

	void chk(boolean b) {
		if (b)
			return;
		System.out.println(new Error().getStackTrace()[1]);
		exit(999);
	}
	void deb(String fmt, Object... args) {
		System.out.printf(Locale.US, fmt + "%n", args);
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}

import java.util.*;
import java.text.*;

import javax.swing.plaf.basic.BasicScrollPaneUI.HSBChangeListener;

import java.io.*;
import java.math.*;
public class code5 {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	static int dx[]={1,-1,-1,1,0,0,1,-1},dy[]={1,-1,1,-1,1,-1,0,0};
	int small[];
	ArrayList<Integer> al;
	void solve() throws Exception
	{
		long l=nl()-1;
		long temp1=l-1;
		long r=nl();
		long temp2=r;
		al=new ArrayList<Integer>();
		for(int i=0;l!=0;i++)
		{
			al.add((int)(l%10));
			l/=10;
		}
		dp=new long[al.size()][2];
		for(int i=0;i<al.size();i++)
			Arrays.fill(dp[i],-1);
		long t1=Math.min(8,temp1)+rec(al.size()-1,1);
		al=new ArrayList<Integer>();
		for(int i=0;r!=0;i++)
		{
			al.add((int)(r%10));
			r/=10;
		}
		dp=new long[al.size()][2];
		for(int i=0;i<al.size();i++)
			Arrays.fill(dp[i],-1);
		long t2=Math.min(8,temp2)+rec(al.size()-1,1);
		out.println(t2-t1);
	}
	long dp[][];
	long rec(int index,int limit)
	{
		if(index<0)
			return 0;
		if(index==0)
			return 1;
	//	System.out.println(index+" "+limit);
		if(dp[index][limit]!=-1)
			return dp[index][limit];
		dp[index][limit]=0;
		int max;
		if(limit==1) {
			max=al.get(index);
			limit=1;
		}
		else {
			max=9;
			limit=0;
		}
		int start=index==0?1:0;
		for(int i=start;i<=max;i++)
		{
			if(i==max)
				dp[index][limit]+=rec(index-1,limit);
			else
				dp[index][limit]+=rec(index-1,0);
		}
		return dp[index][limit];
	}
	void prime(int n)
	{
		small=new int[n+1];
		for(int i=2;i*i<=n;i++)
		{
			if(small[i]!=0)
				continue;
			for(int j=i;i*j<=n;j++)
			{
				if(small[i*j]==0)
					small[i*j]=i;
			}
		}
		for(int i=1;i<=n;i++)
			small[i]=small[i]==0?i:small[i];
	}
	public static int count(int x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	       int x,y,k;
	       int i;
	       long cost;
		Pair (int x,int y,int i){
			this.x=x;
			this.y=y;
			this.i=i;
		}
		public int compareTo(Pair o) {
				if(this.y!=o.y)
				return this.y-o.y;
				return o.x-this.x;
		}

		public String toString(){
			return x+" "+y+" "+k+" "+i;}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(y==0)
			return x;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new code5().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

	    	//new code5().run();
		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}
		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}

import java.util.Scanner;

public class A_Little_Elephant_and_Interval {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String left = sc.next();
        String right = sc.next();
        System.out.println(calc(right)-calc(left));

    }
    private static long calc(String s) {
        long res = 0;
        if (s.length() == 1){
            return Integer.parseInt(s);
        }
        if (s.length() == 2){
            res = s.codePointAt(0)-39;;
            if (s.charAt(0) <= s.charAt(1)){
                res ++;
            }
            return res;
        }
        long a = 0;
        if (s.charAt(0) > s.charAt(s.length()-1)){
            a = Long.parseLong(s.substring(0,s.length()-1))-1;
            String t = a+"";
            t += t.charAt(0);
            boolean f = true;
            for (int i = 0; i < t.length(); i++) {
                if (t.charAt(i) !='9'){
                    f = false;
                    break;
                }
            }
            if (!f) s = t;
        }
        String t = s.substring(1,s.length()-1);
        res += Long.parseLong(t)+1;
        res += (s.codePointAt(0)-49)*Math.pow(10, t.length());
        for (int i = 1; i < t.length(); i++) {
            res += 9*Math.pow(10, i);
        }
        res += 18;
        return res;
    }

}
/*
10001 10000002
Answer
999001
*/

import java.util.Scanner;

public class C_Litter_Elephant_And_Interval {
	public static void main(String[] args){
		Scanner input=new Scanner(System.in);
		long l=input.nextLong(),r=input.nextLong();
		long count1=1,count2=1;
		long l1=l,r1=r;
		while(l1/10>9){
			l1=l1/10;
			count1++;
		}
		l1=l1/10;
		count1++;
		//System.out.println("count1="+count1);
		while(r1/10>9){
			r1=r1/10;
			count2++;
		}
		r1=r1/10;
		count2++;
		//System.out.println("count2="+count2);
		int i;long count=0;long countex=9,countin=9;
		if(l<10)countex=l-1;
		else if(l<100){
			l1=l/10;
			l=l%10;
			//System.out.println("l1="+l1);
			//System.out.println("l="+l);
			if(l1>l)countex=l+8;
			else countex=l1+9;
			if(l1==l)countex--;
		}
		else{
			for(i=1;i<count1-2;i++)countex=countex*10+9;
			countex=countex+9;
			//System.out.println("countex now="+countex);
			//System.out.println("l1="+l1);
			//System.out.println("l%10="+l%10);
			if(l1<=l%10){
				if(l1==l%10)countex--;
				long j=1,k;
				for(k=1;k<count1-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("l1="+l1);
				countex=countex+j*(l1-1);
				//System.out.println("countex now="+countex);
				j=j*10*l1;
				l1=l%j;
				//System.out.println("l1="+l1);
				l1=l1/10;
				//System.out.println("l1="+l1);
				countex=countex+l1+1;
				if(l1==l%10)countex--;
				//System.out.println("countex="+countex);
			}
			else{
				long k,j=1;
				for(k=0;k<count1-2;k++)j=j*10;
				k=(l1-1)*j;
				countex=countex+k;
				for(i=0;i<count1-1;i++)l1=l1*10;
				l=l%l1;
				l=l/10;
				if(l>=1)l--;
				else l=0;
				countex=countex+l;
				//System.out.println("countex="+countex);
			}
		}

		if(r<10)countin=r-1;
		else if(r<100){
			r1=r/10;
			r=r%10;
			if(r1>r)countin=r+8;
			else countin=r1+9;
			//if(r1==r)countin--;
		}
		else{
			for(i=1;i<count2-2;i++)countin=countin*10+9;
			countin=countin+9;
			//System.out.println("countin now="+countin);
			//System.out.println("r1="+r1);
			//System.out.println("r%10="+r%10);
			if(r1<=r%10){
				long j=1,k;
				for(k=1;k<count2-1;k++)j=j*10;
				//System.out.println("j="+j);
				//System.out.println("r1="+r1);
				countin=countin+j*(r1-1);
				//System.out.println("countin now="+countin);
				j=j*10*r1;
				r1=r%j;
				//System.out.println("r1="+r1);
				r1=r1/10;
				//System.out.println("r1="+r1);
				countin=countin+r1+1;
				//System.out.println("countin="+countin);
			}
			else{
				long k,j=1;
				for(k=0;k<count2-2;k++)j=j*10;
				k=(r1-1)*j;
				countin=countin+k;
				for(i=0;i<count2-1;i++)r1=r1*10;
				r=r%r1;
				r=r/10;
				if(r>=1)r--;
				else r=0;
				countin=countin+r;
				//System.out.println("countin="+countin);
			}
		}
		//System.out.println("countex="+countex);
		//System.out.println("countin="+countin);
		count=countin-countex;
		System.out.println(count);
	}
}

import java.util.*;

public class C{
	public static long powerKey(long x){
		int y = -1;
		while( x > 0 ){
			x /= 10;
			y++;
		}
		long ans = 1;
		while( y-- > 0 ){
			ans *= 10;
		}
		return ans;
	}
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		long n = stdIn.nextLong();
		long m = stdIn.nextLong();
		long div1 = powerKey(n);
		long div2 = powerKey(m);
		long a1 = n%10;
		long b1 = m%10;;
		long a_top = (n/div1);
		long b_top = (m/div2);
		long ans = 0;
		while( a1 != a_top ){
			n++;
			a1 = n%10;
			a_top = n/powerKey(n);
		}
		while( b1 != b_top ){
			m--;
			b1 = m%10;
			b_top = m/powerKey(m);
		}
		if( n/10 == 0 ){
			if( m/10 == 0 ){
				ans = m-n+1;
			} else {
				ans += 10-n;
				n = 11;
			}
		}
		ans += m/10 - n/10 + 1;
		System.out.println(ans);
	}
}

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

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class A204
{

	public static int mod = 1000000007;
	public static long INF = (1L << 60);
	static FastScanner2 in = new FastScanner2();
	static OutputWriter out = new OutputWriter(System.out);
	static long l,r;
	public static long func(long n)
	{
		String s=n+"";
		long answer=0;
		for(int i=1;i<s.length();i++)
		{
			if(i==1 || i==2)
			{
				answer+=9;
				continue;
			}
			else
			{
				answer+=(long)9*pow(10, i-2);
			}
		}
		int first=s.charAt(0)-'0';
		int last=s.charAt(s.length()-1)-'0';
		if(last>=first)
		{
			long tmp=1;
			for(int i=1;i<s.length()-1;i++)
			{
				tmp*=(s.charAt(i)-'0'+1);
			}
			answer+=(long)first*tmp;
			return answer;
		}
		else
		{
			long tmp=1;
			for(int i=1;i<s.length()-1;i++)
			{
				tmp*=(s.charAt(i)-'0'+1);
			}
			answer+=(long)(first-1)*tmp;
			return answer;
		}
	}
	public static void main(String[] args)
	{

		l=in.nextLong();
		r=in.nextLong();
		long answer=func(r)-func(l-1);
		out.println(answer);
		out.close();

	}

	public static long pow(long x, long n)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p))
		{
			if ((n & 1) != 0)
			{
				res = (res * p);
			}
		}
		return res;
	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FastScanner2
	{
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

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

		public String nextLine()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n)
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextLong();
			}
			return arr;
		}

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

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

	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream)
		{
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine()
		{
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					fullLine = reader.readLine();
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next()
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

		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 int nextInt()
		{
			return Integer.parseInt(next());
		}
	}

	static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class P204A {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(in, out);
		out.close();
	}

	static class Task {
		public void solve(InputReader in, PrintWriter out) {
			long l = in.nextLong();
			long r = in.nextLong();
			String sr = String.valueOf(r);
			int lenr = sr.length();
			long total = 0;
			if (l < 10 && r < 10) {
				out.println(r - l + 1);
				return;
			} else if (l < 10/*&&r>=10*/) {
				total += 10 - l;
				l = 11;
			}
			StringBuilder sl = new StringBuilder(String.valueOf(l));
			char ls = sl.charAt(0);
			char le = sl.charAt(sl.length() - 1);
			if (ls >= le) {
				sl.setCharAt(sl.length() - 1, ls);
			} else /*(ls<le)*/ {
				if (sl.length() > 2)
					total += (long) (Math.pow(10, sl.length() - 2) - Long.valueOf(sl.substring(1, sl.length() - 1)))
							- 1;
				sl.setCharAt(0, (char) (ls + 1));
				for (int i = 1; i + 1 < sl.length(); i++)
					sl.setCharAt(i, '0');
				sl.setCharAt(sl.length() - 1, (char) (1 + ls));
			}
			while (true) {
				long add = (long) (Math.pow(10, sl.length() - 2));
				if (sl.length() < lenr) {
					if (sl.length() > 2 && sl.charAt(1) != '0') {
						total += (9 - sl.charAt(0) + '0') * add
								+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
					} else {
						total += (9 - sl.charAt(0) + '0' + 1) * add;
					}
				} else {
					if (sl.charAt(0) == sr.charAt(0)) {
						if (sl.length() > 2) {
							long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
									- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
							if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
								diff--;
							}
							total += diff;
						} else
							total++;
					} else {
						int k = sr.charAt(0) - '0' - 1;
						if (sl.length() > 2 && sl.charAt(1) != '0') {
							total += (k - sl.charAt(0) + '0') * add
									+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
						} else {
							total += (k - sl.charAt(0) + '0' + 1) * add;
						}
						sl = new StringBuilder(
								String.valueOf((long) ((k + 1) + (k + 1) * Math.pow(10, sl.length() - 1))));
						if (Long.valueOf(sl.toString()) <= r) {
							if (sl.length() > 2) {
								long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
										- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
								if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
									diff--;
								}
								total += diff;
							} else
								total++;
						}

					}
					break;
				}
				sl = new StringBuilder(String.valueOf(1 + (long) Math.pow(10, sl.length())));
			}
			out.println(total);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
}

import java.io.*;
import java.util.*;

public class Dp {

    public static void main(String args[]) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;
        while (t-- > 0) {
            long l = in.nextLong();
            long r = in.nextLong();
            out.println(fuc(r) - fuc(l - 1));
        }
        out.close();
    }

    static long fuc(long r) {
        long val[] = new long[18];
        val[1] = 9;
        val[2] = 9;
        for (int i = 3; i < 18; i++) {
            val[i] = val[i - 1] * 10;
        }
        int dig = 0;
        long rr = r;
        ArrayList<Integer> aa = new ArrayList<Integer>();
        while (rr > 0) {
            dig++;
            aa.add((int) (rr % 10));
            rr = rr / 10;
        }
        if (dig <= 1) return r;
        long ans = 0;
        for (int i = 0; i < dig; i++) {
            ans += val[i];
        }
        int i = 0;
        int j = aa.size() - 1;
        long curr = 1;
        curr = curr * Math.min(aa.get(i), aa.get(j));
        i++;
        while (i < j) {
            curr = curr * (aa.get(i) + 1);
            i++;
        }

        return ans + curr;
    }

    static int top[];
    static int curr = 0;
    static int visited[];
    static ArrayList<Integer> adj[];

    static void dfs(int i) {
        if (visited[i] == 0) {
            visited[i] = 1;
            for (int j : adj[i]) {
                dfs(j);
            }
            top[curr] = i;
            curr++;
        }
    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

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

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

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}

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

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;

public class A204_1
{

	public static long mod = 1000000007;
	public static long INF = (1L << 60);
	static FastScanner2 in = new FastScanner2();
	static OutputWriter out = new OutputWriter(System.out);
	static String w;
	static int[][][] dp;
	public static int func(int initial,int remains,boolean lessthan)
	{
		if(remains==1)
		{
			if(initial==0)
			{
				if(lessthan)
				{
					return 9;
				}
				else
				{
					//only for single digit number
					if(w.length()>1)
						System.out.println("assump wrong");
					return w.charAt(w.length()-1)-'0';
				}
			}
			else
			{
				//initial is non zero
				if(lessthan)
				{
					return 1;
				}
				else
				{
					return initial<=w.charAt(w.length()-1)-'0'?1:0;
				}
			}
		}
		if(dp[initial][remains][lessthan?1:0]!=-1)
			{
			return dp[initial][remains][lessthan?1:0];
			}
		int answer=0;
		for(int i=0;i<(lessthan?10:w.charAt(w.length()-remains)-'0'+1);i++)
		{
			answer+=func(initial==0?i:initial, remains-1, lessthan?lessthan:(i!=w.charAt(w.length()-remains)-'0'));
		}
		return dp[initial][remains][lessthan?1:0]=answer;

	}
	public static void main(String[] args)
	{

		long a=in.nextLong();
		long b=in.nextLong();
		dp=new int[10][20][2];
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<20;j++)
			{
				Arrays.fill(dp[i][j], -1);
			}
		}
		w=b+"";
		long ans1=func(0, w.length(), false);
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<20;j++)
			{
				Arrays.fill(dp[i][j], -1);
			}
		}
		a--;
		w=a+"";
		long ans2=func(0, w.length(), false);
		out.println(ans1-ans2);
		out.close();

	}

	public static long pow(long x, long n)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p))
		{
			if ((n & 1) != 0)
			{
				res = (res * p);
			}
		}
		return res;
	}

	public static long pow(long x, long n, long mod)
	{
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)
		{
			if ((n & 1) != 0)
			{
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2)
	{
		long r;
		while (n2 != 0)
		{
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2)
	{
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FastScanner2
	{
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

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

		public String nextLine()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n)
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++)
			{
				arr[i] = nextLong();
			}
			return arr;
		}

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

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

	static class InputReader
	{
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream)
		{
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine()
		{
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					fullLine = reader.readLine();
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next()
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e)
				{
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

		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 int nextInt()
		{
			return Integer.parseInt(next());
		}
	}

	static class OutputWriter
	{
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream)
		{
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer)
		{
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects)
		{
			for (int i = 0; i < objects.length; i++)
			{
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects)
		{
			print(objects);
			writer.println();
		}

		public void close()
		{
			writer.close();
		}

		public void flush()
		{
			writer.flush();
		}
	}

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Mahmoud Aladdin
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, Scanner jin, PrintWriter jout) {
        String left = jin.next();
        String right = jin.next();

        long count = 0;
        for(int i = left.length() + 1; i <= right.length(); i++) {
            if(i > 2) {
                count += 9 * Math.pow(10, i - 2);
            } else {
                count += 9;
            }
        }

        long cl = compute(left);
        long cr = compute(right);

        jout.println(count + cl - cr);
    }

    private long compute(String left) {
        int val = (left.charAt(0) - '0') + 1;
        int len = Math.max(0, left.length()-2);

        long tot = (long) Math.pow(10, len);
        long result = (9 - val + 1) * tot;
        if(left.charAt(0) == left.charAt(left.length() - 1)) {
            if(left.length() > 1) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken + 1;
            } else {
                result++;
            }
        } else {
            if(left.length() > 2) {
                long taken = Long.parseLong(left.substring(1, left.length() - 1));
                result += tot - taken;
                if (left.charAt(left.length() - 1) > left.charAt(0))
                    result--;
            } else if(left.length() > 1) {

            } else {
                result++;
            }
        }
        return result;
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class P204A {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(in, out);
		out.close();
	}

	static class Task {
		public void solve(InputReader in, PrintWriter out) {
			long l = in.nextLong();
			long r = in.nextLong();
			String sr = String.valueOf(r);
			int lenr = sr.length();
			long total = 0;
			if (l < 10 && r <= 10) {
				out.println(Math.min(9, r) - l + 1);
				return;
			} else if (l < 10/*&&r>10*/) {
				total += 10 - l;
				l = 11;
			}
			StringBuilder sl = new StringBuilder(String.valueOf(l));
			char ls = sl.charAt(0);
			char le = sl.charAt(sl.length() - 1);
			if (ls >= le) {
				sl.setCharAt(sl.length() - 1, ls);
			} else /*(ls<le)*/ {
				if (sl.length() > 2)
					total += (long) (Math.pow(10, sl.length() - 2) - Long.valueOf(sl.substring(1, sl.length() - 1)))
							- 1;
				sl.setCharAt(0, (char) (ls + 1));
				for (int i = 1; i + 1 < sl.length(); i++)
					sl.setCharAt(i, '0');
				sl.setCharAt(sl.length() - 1, (char) (1 + ls));
			}
			while (true) {
				long add = (long) (Math.pow(10, sl.length() - 2));
				if (sl.length() < lenr) {
					if (sl.length() > 2 && sl.charAt(1) != '0') {
						total += (9 - sl.charAt(0) + '0') * add
								+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
					} else {
						total += (9 - sl.charAt(0) + '0' + 1) * add;
					}
				} else {
					if (sl.charAt(0) == sr.charAt(0)) {
						if (sl.length() > 2) {
							long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
									- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
							if (sl.charAt(sl.length() - 1) > sr.charAt(sr.length() - 1)) {
								diff--;
							}
							total += diff;
						} else
							total++;
					} else {
						int k = sr.charAt(0) - '0' - 1;
						if (sl.length() > 2 && sl.charAt(1) != '0') {
							total += (k - sl.charAt(0) + '0') * add
									+ (add - Long.valueOf(sl.substring(1, sl.length() - 1)));
						} else {
							total += (k - sl.charAt(0) + '0' + 1) * add;
						}
						sl = new StringBuilder(
								String.valueOf((long) ((k + 1) + (k + 1) * Math.pow(10, sl.length() - 1))));
						if (Long.valueOf(sl.toString()) <= r) {
							if (sl.length() > 2) {
								long diff = Long.valueOf(sr.substring(1, sr.length() - 1))
										- Long.valueOf(sl.substring(1, sl.length() - 1)) + 1;
								if (sl.charAt(0) > sr.charAt(sr.length() - 1)) {
									diff--;
								}
								total += diff;
							} else
								total++;
						}

					}
					break;
				}
				sl = new StringBuilder(String.valueOf(1 + (long) Math.pow(10, sl.length())));
			}
			out.println(total);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
}

import java.util.Scanner;

public class A {
    public static long getCountWithLenght(int length) {
        if (length == 1) {
            return 9;
        } else
            return 9L * pow10(length - 2);
    }

    public static long pow10(int pow) {
        if (pow <= 0)
            return 1;
        return 10L * pow10(pow - 1);
    }

    public static long getRemaining(char[] numb) {
        long res = 0;
        if (numb[0] >= numb[numb.length - 1]) {
            for (int i = numb.length - 2; i > 0; i--) {
                long tmp = 1L;
                for (int j = numb.length - 2; j > 0; j--) {
                    if (j > i) {
                        tmp *= (numb[j] - '0' + 1);
                    } else if (j == i) {
                        tmp *= ('9' - numb[j]);
                    } else {
                        tmp *= ('9' - numb[j] + 1);
                    }
                }
                res += tmp;
            }
        } else {
            res = 1;
            for (int i = 1; i < numb.length - 1; i++) {
                res *= ('9' - numb[i] + 1);
            }
        }
        res += (long) ('9' - numb[0]) * pow10(numb.length - 2);
        return res;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] low = sc.next().toCharArray();
        char[] high = sc.next().toCharArray();
        long res = 0;
        if (low.length == high.length) {
            res = getRemaining(low) - getRemaining(high);
        } else {
            for (int i = low.length + 1; i < high.length; i++) {
                res += getCountWithLenght(i);
            }
            res += getRemaining(low);
            res += getCountWithLenght(high.length)
                    - getRemaining(high);
        }
        if (high[0] == high[high.length - 1]) {
            res++;
        }
        System.out.println(res);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_204A solver = new CF_204A();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_204A {
        long[] tenPower = power(18);

        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            long l = in.l(), r = in.l();
            out.println(cal(r) - cal(l - 1));
            //cal(1010);
        }

        long cal(long mx) {
            if (mx < 10) return mx;
            long ten = 1, ans = 0;
            int digits = 1;
            while (ten <= mx) {
                for (int i = 1; i <= 9 && i * ten <= mx; ++i) {
                    if ((i + 1) * ten <= mx) {
                        if (ten == 1)
                            ans++;
                        else
                            ans += tenPower[digits - 2];
                    }
                    else if (i * ten + i <= mx) {
                        ans += 1 + (mx / 10 - i * (ten / 10));
                        if (i > mx % 10) ans--;
                    }
                }

                ten *= 10;
                digits++;
            }
            return ans;
        }

        long[] power(int max) {
            long[] rs = new long[max + 1];
            rs[0] = 1;
            for (int i = 1; i <= max; ++i)
                rs[i] = rs[i - 1] * 10;
            return rs;
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            long l() {
                return in.nextLong();
            }

        }

    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                                            //(new FileReader("input.in"));
        StringBuilder out = new StringBuilder();
        StringTokenizer tk;
        //PrintWriter pw = new PrintWriter("output.out", "UTF-8");

        long [] nines = new long[20];
        nines[1] = 9l;
        for(int i=2; i<=19; i++)
            nines[i] = (nines[i-1]*10)+9l;

        long [] dp = new long[20];
        dp[1] = dp[2] = 9;

        for(int i=3; i<=19; i++)
            dp[i] = 9*(nines[i-2]+1);

        tk = new StringTokenizer(in.readLine());
        String s = tk.nextToken(),e = tk.nextToken();

        long ans = 0;

        if(e.length() == 1) ans = (e.charAt(0)-'0')-(s.charAt(0)-'0')+1;
        else if(s.length() == e.length()) {
            long a = 0,b = 0;
            if(e.length()==2) {
                a = min(e.charAt(0)-'0',e.charAt(e.length()-1)-'0');
                b = max(s.charAt(0)-'0',s.charAt(1)-'0');
            } else {
                long x = parseLong(e);
                while(true) {
                    String t = ""+x;
                    if(t.charAt(0) == t.charAt(t.length()-1))
                        break;
                    x--;
                }

                long y = parseLong(s);
                if(x < y) {
                    System.out.println("0");
                    return;
                }

                while(true) {
                    String t = ""+y;
                    if(t.charAt(0)!=t.charAt(t.length()-1))
                        break;
                    y++;
                }

               String x1 = ""+x,x2 = ""+y;

               a = (parseLong(x1.substring(1, x1.length()-1))+1)+(x1.charAt(0)-'0'-1)*dp[x1.length()-1];
               b = (parseLong(x2.substring(1, x2.length()-1))+1)+(x2.charAt(0)-'0'-1)*dp[x2.length()-1];
            }

            if(a < b) ans = 0;
            else ans = a-b+1;
        } else {
            for(int i=s.length()+1; i<e.length(); i++)
                ans += dp[i];

            long x = parseLong(e);
            while(true) {
                String t = ""+x;
                if(t.charAt(0) == t.charAt(t.length()-1))
                    break;
                    x--;
            }

            long y = parseLong(s);

            while(true) {
                String t = ""+y;
                if(t.charAt(0)!=t.charAt(t.length()-1))
                   break;
                   y++;
                }

            String x1 = ""+x,x2 = ""+y;
            long a=0,b=0;

            if(x1.length()>2)
                a = (parseLong(x1.substring(1, x1.length()-1))+1)+(x1.charAt(0)-'0'-1)*dp[x1.length()-1];
            else a = x1.charAt(0)-'0';

            if(x2.length() > 2)
                b = (nines[x2.length()-2]-parseLong(x2.substring(1, x2.length()-1))+1)+(9-x2.charAt(0)-'0')*dp[x2.length()-1];
            else b = 9-(x2.charAt(0)-'0');

            ans += a+b;
        }

        System.out.println(ans);
    }

}

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  Main  {

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//ArrayList<test> lis = new ArrayList<test>();
//	static long sum=0;
//	static boolean f=false;
	//static String s[],r="";
//	static int dx[]={1,-1,0,0};
	//static int dy[]={0,0,1,-1};

public  static void main(String[] args) throws IOException {
   //googlein.txt C-small-attempt0.in
//	Scanner sc =new Scanner(new File("file.txt"));
	 Scanner sc =new Scanner(System.in);
	  //File file = new File("file.txt");
	//	PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
	//	sc.useDelimiter("(\\s)+|[,]");

	  while(sc.hasNext()){
		   //long sum=0;
	//	  int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();

		//String s=sc.next();
		long l=sc.nextLong()-1,r=sc.nextLong(),A=0,B=0;
		String L=String.valueOf(l);
		String R=String.valueOf(r);

		if( l<10000 ){

			for(int i=1;i<=l;i++){String s=String.valueOf(i);  if( s.charAt(0)==s.charAt(s.length()-1)  )A++;  }

		}
		else A=f( L.charAt(0)-'0',L.charAt(L.length()-1)-'0', L.length() ,l) ;

       if( r<10000 ){

			for(int i=1;i<=r;i++){String s=String.valueOf(i);  if( s.charAt(0)==s.charAt(s.length()-1)  )B++;  }

		}
		else B=f( R.charAt(0)-'0',R.charAt(R.length()-1)-'0', R.length() ,r) ;

	//db(A,B);
         System.out.println(B-A);

	  }

}

 static long f(int a,int b,int k,long p){
	long x=108;
	String s=String.valueOf(p);
	//db(a,b,k,p);
	 if( a<b ){

		 for(int i=4;i<=k;i++){

			if( i==k ){ x+=(a-1)*pow(10,i-2)+Long.parseLong(s.substring(1,s.length()-1))+1 ; break;  }
		    x+=9*pow(10,i-2);
		 }
	 }
	 else if(a==b) {
			long e= Long.parseLong(s.substring(1,s.length()-1))+1;

			 for(int i=4;i<=k;i++){
				if( i==k ){ x+=(a-1)*pow(10,i-2)+e ; break;  }
			    x+=9*pow(10,i-2);
			 }
		 }

	 else  {
		long e= Long.parseLong(s.substring(1,s.length()-1));

		 for(int i=4;i<=k;i++){
			if( i==k ){ x+=(a-1)*pow(10,i-2)+e ; break;  }
		    x+=9*pow(10,i-2);
		 }
	 }

	 return x;
 }

	// db("Case #"+(k)+": "+c);
	 //	pw.println("Case #"+(k)+": "+c);

	 	//pw.flush();
	 	//pw.close();

    static void db(Object... os){
	         System.err.println(Arrays.deepToString(os));

	}

}

/*class P implements Comparable<P>{
    int v,vv,t;
	P(int v,int vv,int t){
		this.v=v;
	    this.vv=vv;
	    this.t=t;
	}
	  public int compareTo(P x){
          return t-x.t;
	   }

}*/

import java.util.Scanner;

public class prime_less {
    public static void main(String[] args)  throws Exception{
        new prime_less().run(args);

    }
    static long[] store;

    private void run(String[] args) throws Exception{
        Scanner input = new Scanner(System.in);
        String fir = input.next();
        String sec = input.next();
        store = new long[19];
        store[0] = 9;
        for(int i = 1; i < 19; i++){
            store[i] = (long) (store[i-1]+9*Math.pow(10, i-1));
        }
        System.out.println(calc(sec) - (calc(fir)-check(fir)));
    }

    private int check(String num){
        int len = num.length();
        if(len == 1)
            return 1;
        int begin = Integer.parseInt(num.substring(0, 1));
        int end = Integer.parseInt(num.substring(len-1, len));
        if(begin == end)
            return 1;
        else
            return 0;
    }

    private long calc(String num){
        int len = num.length();
        if(len == 1)
            return Long.parseLong(num);
        else if(len >= 19){
            return new Long("100000000000000008");
        }
        else{
            int begin = Integer.parseInt(num.substring(0, 1));
            int end = Integer.parseInt(num.substring(len-1, len));
            long between = 0;
            if(len == 2){
                between = 1;
            }
            else{
                between = Long.parseLong(num.substring(1, len-1))+1;
            }
            if(end >= begin){
                return (long) (between+(begin-1)*Math.pow(10, len-2) + store[len-2]);
            }
            else{
                if(between-1 >= 0){
                    return (long) (between-1 + (begin-1)*Math.pow(10, len-2) + store[len-2]);
                }
                else{
                    return (long) ((begin-1)*Math.pow(10, len-2) + store[len-2]);
                }
            }
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class LittleElephantandInterval {

	static char[] x, y;
	static long[][][][] dp;

	static long solve(int i, int a, int b, int f) {
		if (i == x.length)
			return f == -1 ? 1 : 0;
		if (dp[i][f][a][b] != -1)
			return dp[i][f][a][b];
		long cnt = 0;
		for (int j = 0; j < 10; j++) {
			if (a == 0 && b == 0) {
				if (j >= x[i] - '0' && j <= y[i] - '0') {
					cnt += solve(i + 1, j > x[i] - '0' ? 1 : 0,
							j < y[i] - '0' ? 1 : 0, i == 0 ? j
									: (i + 1 == x.length && j == f ? -1 : f));
				}
			} else if (a == 0 && b == 1) {
				if (j >= x[i] - '0') {
					cnt += solve(i + 1, j > x[i] - '0' ? 1 : 0, 1, i == 0 ? j
							: (i + 1 == x.length && j == f ? -1 : f));
				}
			} else if (a == 1 && b == 0) {
				if (j <= y[i] - '0')
					cnt += solve(i + 1, 1, j < y[i] - '0' ? 1 : 0, i == 0 ? j
							: (i + 1 == x.length && j == f ? -1 : f));
			} else {
				cnt += solve(i + 1, 1, 1, i == 0 ? j : (i + 1 == x.length
						&& j == f ? -1 : f));
			}
		}
		return dp[i][f][a][b] = cnt;
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		long l = nxtLng();
		long r = nxtLng();
		y = Long.toString(r).toCharArray();
		String tmp = Long.toString(l);
		int flag = 0;
		if (l != r && l > 10)
			flag = tmp.charAt(0) == tmp.charAt(tmp.length() - 1) ? 1 : 0;
		while (tmp.length() < y.length)
			tmp = "0" + tmp;
		x = tmp.toCharArray();
		dp = new long[x.length][10][2][2];
		for (long[][][] a : dp)
			for (long[][] b : a)
				for (long[] c : b)
					Arrays.fill(c, -1);
		out.println(solve(0, 0, 0, 0)
				+ (l < 10 ? (r <= 10 ? r - l : 10 - l) : 0) + flag);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.util.*;
import java.io.*;

public class Main
{
    public static void main(String arg[])
    {
        new Main();
    }
    public Main()
    {
        new TaskA();
    }
}

class TaskA
{
    public TaskA()
    {
        Scanner cin=new Scanner(new BufferedInputStream(System.in));
        long l=cin.nextLong(),r=cin.nextLong();
        long answer=0;
        long a=1,b=1;
        while (a*10<=l) a*=10;
        while (b*10<=r) b*=10;
        for (long i=a;i<=b;i*=10)
        {
            long begin=i==a?l/i:1;
            long end=i==b?r/i:9;
            if (i==1)
            {
                for (long j=begin;j<=end;j++)
                {
                    long x=j;
                    long y=j;
                    if (l>x) x=l;
                    if (r<y) y=r;
                    if (x<=y) answer+=y-x+1;
                }
            }
            else
            {
                for (long j=begin;j<=end;j++)
                {
                    long x=j*i+j;
                    long y=x+(i/10-1)*10;
                    if (l>x) x=l;
                    if (r<y) y=r;
                    if (x<=y) answer+=(y-x)/10+1;
                }
            }
        }
        System.out.println(answer);
        cin.close();
    }
}

import java.io.*;
import java.util.*;

public class Main
{
    public static int cnt(long n)
    {
        int res = 0;
        while (n > 0)
        {
            ++res;
            n /= 10;
        }
        return res;
    }
    public static int fd(long n)
    {
        while (n > 9)
            n /= 10;
        return (int)n;
    }
    public static int ld(long n)
    {
        return (int)(n % 10);
    }
    public static long solve(long n)
    {
        long res = 0, cur;
        int q = cnt(n);
        for (int i = 1; i < q; ++i)
        {
            cur = 9;
            for (int j = 0; j + 2 < i; ++j)
                cur *= 10;
            res += cur;
        }
        cur = 1;
        for (int j = 0; j + 2 < q; ++j)
            cur *= 10;
        int f = fd(n), l = ld(n);
        res += cur * (f - 1);
        if (n < 100)
        {
            if (n > 9 && fd(n) <= ld(n))
                ++res;
            return res;
        }
        cur = 1;
        long p = 1;
        n /= 10;
        boolean mlt = f > l;
        while (n > 9)
        {
            cur += (n % 10 + (mlt ? -1 : 0)) * p;
            mlt = false;
            p *= 10;
            n /= 10;
        }
        res += cur;
        return res;
    }
    public static void main(String[] args) throws IOException
    {
//      Scanner in = new Scanner(System.in);
        FastScanner sc = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        long l = sc.nextLong(), r = sc.nextLong();
        System.out.print(solve(r) - solve(l - 1));
        System.out.close();
    }
}

class FastScanner
{
    private BufferedReader Reader;
    private StringTokenizer Tokenizer;
    public FastScanner (BufferedReader Reader)
    {
        this.Reader = Reader;
    }
    public String nextToken() throws IOException
    {
        while (Tokenizer == null || !Tokenizer.hasMoreTokens())
            Tokenizer = new StringTokenizer(Reader.readLine());
        return Tokenizer.nextToken();
    }
    public int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}

import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
public class A {

    long cal(long c) {
        String s = c+"";
        int l = s.length();
        long r = min(9, c);
        long t = 1;
        for (int i=2; i<l; i++) {
            r += 9*t;
            t *= 10;
        }
        if (l>1) {
            int d = min(s.charAt(0), s.charAt(l-1))-'0';
            if (l==2)
                r += d;
            else
                r += d*(1+Integer.parseInt(s.substring(1, l-1)));
        }
        return r;
    }

    public A() throws Exception {
        long l = in.nextLong();
        long r = in.nextLong();
        System.out.println(cal(r)-cal(l-1));
    }

    Scanner in = new Scanner(System.in);
    public static void main(String[] args) throws Exception { // {{{
        new A();
    } // }}}
    public static void debug(Object... arr) { // {{{
        System.err.println(Arrays.deepToString(arr));
    } // }}}
}