import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int i = A; i <= B; i++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        }

        System.out.println(cnt);

        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int i = A; i <= B; i++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        }

        System.out.println(cnt);

        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int i = A; i <= B; i++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        }

        System.out.println(cnt);

        return;
    } run {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int i = A; i <= B; i++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        }

        System.out.println(cnt);

        return;
    } 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++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        } int i = A; int i = A; i A i <= B i B i++ i++ i {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        } {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        } char[] s = new StringBuilder().append(i).toString().toCharArray(); s new StringBuilder().append(i).toString().toCharArray() new StringBuilder().append(i).toString().toCharArray new StringBuilder().append(i).toString() new StringBuilder().append(i).toString new StringBuilder().append(i) new StringBuilder().append new StringBuilder() i boolean ok = true; ok true for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            } int j = 0; int j = 0; j 0 j < 5 / 2 j 5 / 2 5 2 j++ j++ j {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            } {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            } if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                } s[j] != s[4 - j] s[j] s j s[4 - j] s 4 - j 4 j {
                    ok = false;
                    break;
                } ok = false ok false break; if (ok) cnt++; ok cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt return;
import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int cnt = 0;
        for (int i = A; i <= B; i++) {
            char[] s = new StringBuilder().append(i).toString().toCharArray();
            boolean ok = true;
            for (int j = 0; j < 5 / 2 ; j++) {
                if (s[j] != s[4 - j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) cnt++;
        }

        System.out.println(cnt);

        return;
    }

}