import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    } main {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    } 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 sum = 0; sum 0 for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        } int a = 1; int a = 1; a 1 a < 10 a 10 a++ a++ a {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        } {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        } for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            } int b = 0; int b = 0; b 0 b < 10 b 10 b++ b++ b {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            } {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            } for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                } int c = 0; int c = 0; c 0 c < 10 c 10 c++ c++ c {
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                } {
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                } String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a); strNum String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a) String.valueOf(b) String.valueOf(c) String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a) String.valueOf(a) String.valueOf String a String.valueOf(b) String.valueOf String b String.valueOf(c) String.valueOf String c String.valueOf(b) String.valueOf String b String.valueOf(a) String.valueOf String a int num = Integer.parseInt( strNum ); num Integer.parseInt( strNum ) Integer.parseInt Integer strNum if( A <= num && num <= B ) {
                        sum++;
                    } A <= num && num <= B A <= num A num num <= B num B {
                        sum++;
                    } sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        int sum = 0;
        
        for( int a = 1; a < 10; a++ ) {
            for( int b = 0; b < 10; b++ ) {
                for( int c = 0; c < 10; c++ ){
                    String strNum = String.valueOf(a) + String.valueOf(b) + String.valueOf(c) + String.valueOf(b) + String.valueOf(a);
                    int num = Integer.parseInt( strNum );
                    if( A <= num && num <= B ) {
                        sum++;
                    }
                }
            }
        }
        
        System.out.println(sum);
        
    }
}
