import java.util.*;
import static java.lang.System.out;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    }

    private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    }
} import java.util.*; util.* java import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    }

    private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            if(isKaibunNum(i)){
                count += 1;
            }
        } {
            if(isKaibunNum(i)){
                count += 1;
            }
        } if(isKaibunNum(i)){
                count += 1;
            } isKaibunNum(i) isKaibunNum i {
                count += 1;
            } count += 1 count 1 out.print(count) out.print out count String[] args args private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    } isKaibunNum {
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    } CharSequence sb = new StringBuilder(String.valueOf(n)); sb new StringBuilder(String.valueOf(n)) int l = sb.length(); l sb.length() sb.length sb if(l==1){
            return true;
        } l==1 l 1 {
            return true;
        } return true; true int checkCount = l/2; checkCount l/2 l 2 for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        } int i = 0; int i = 0; i 0 i < checkCount i checkCount i++ i++ i {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        } {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        } char left = sb.charAt(i); left sb.charAt(i) sb.charAt sb i char right = sb.charAt(l-1-i); right sb.charAt(l-1-i) sb.charAt sb l-1-i l-1-i l 1 i if(left != right){
                return false;
            } left != right left right {
                return false;
            } return false; false return true; true int n n public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    }

    private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    }

    private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    }
} Main
import java.util.*;
import static java.lang.System.out;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b ; i++) {
            if(isKaibunNum(i)){
                count += 1;
            }
        }
        out.print(count);
    }

    private static boolean isKaibunNum(int n){
        CharSequence sb = new StringBuilder(String.valueOf(n));
        int l = sb.length();

        if(l==1){
            return true;
        }
        int checkCount = l/2;

        for (int i = 0; i < checkCount ; i++) {
            char left = sb.charAt(i);
            char right = sb.charAt(l-1-i);
            if(left != right){
                return false;
            }
        }
        return true;
    }
}