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

public class Main {
    static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    }
} import java.math.*; math.* java import java.util.*; util.* java public class Main {
    static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    }
} Main static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
} loop {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
} String str = Integer.toString(a); str Integer.toString(a) Integer.toString Integer a int tmp =0; tmp 0 if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        } str.length()%2==0 str.length()%2 str.length() str.length str 2 0 {
            tmp = str.length()/2;
        } tmp = str.length()/2 tmp str.length()/2 str.length() str.length str 2 {
            tmp = (str.length()- 1) / 2;
        } tmp = (str.length()- 1) / 2 tmp (str.length()- 1) / 2 (str.length()- 1) str.length() str.length str 1 2 boolean isLoop = true; isLoop true for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < tmp i tmp i++ i++ i {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        } {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        } if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            } str.charAt(i) != str.charAt(str.length() - i - 1) str.charAt(i) str.charAt str i str.charAt(str.length() - i - 1) str.charAt str str.length() - i - 1 str.length() - i - 1 str.length() str.length str i 1 {
                isLoop = false;
                break;
            } isLoop = false isLoop false break; return isLoop; isLoop int a a public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    } main {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    } 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 cnt = 0; cnt 0 for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        } int i = a; int i = a; i a i <= b i b i++ i++ i {
            if (loop(i))
                cnt++;
        } {
            if (loop(i))
                cnt++;
        } if (loop(i))
                cnt++; loop(i) loop i cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    }
} public class Main {
    static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    }
} Main
import java.math.*;
import java.util.*;

public class Main {
    static boolean loop(int a) {
        String str = Integer.toString(a);
        int tmp =0;
        if(str.length()%2==0){
            tmp = str.length()/2;
        }
        else {
            tmp = (str.length()- 1) / 2;
        }
        boolean isLoop = true;
        for (int i = 0; i < tmp; i++) {
            if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
                isLoop = false;
                break;
            }
        }
        return isLoop;
}
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int cnt = 0;
        for (int i = a; i <= b; i++) {
            if (loop(i))
                cnt++;
        }
        System.out.println(cnt);
    }
}
