import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    }    
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    }    
} Main public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    } main {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int[] c = new int[100000]; c new int[100000] 100000 for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        } int i=1; int i=1; i 1 i<=9 i 9 i++ i++ i {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        } {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        } for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            } int j=0; int j=0; j 0 j<=9 j 9 j++ j++ j {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            } {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            } for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                } int k=0; int k=0; k 0 k<=9 k 9 k++ k++ k {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                } {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                } c[i*10000+j*1000+k*100+j*10+i]=1 c[i*10000+j*1000+k*100+j*10+i] c i*10000+j*1000+k*100+j*10+i j*10 k*100 i*10000+j*1000+k*100+j*10+i i*10000 i 10000 j*1000 j 1000 k*100 k 100 j*10 j 10 i 1 int ans = 0; ans 0 for(int i=a;i<=b;i++)
        {
            ans += c[i];
        } int i=a; int i=a; i a i<=b i b i++ i++ i {
            ans += c[i];
        } {
            ans += c[i];
        } ans += c[i] ans c[i] c i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    }    
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    }    
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] c = new int[100000];
        for(int i=1;i<=9;i++)
        {
            for(int j=0;j<=9;j++)
            {
                for(int k=0;k<=9;k++)
                {
                    c[i*10000+j*1000+k*100+j*10+i]=1;
                }
            }
        }
        int ans = 0;
        for(int i=a;i<=b;i++)
        {
            ans += c[i];
        }
        System.out.println(ans);
    }    
}