import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        } {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) final String s = reader.readLine(); s reader.readLine() reader.readLine reader final String[] sl = s.split(" "); sl s.split(" ") s.split s " " int a = Integer.parseInt(sl[0]); a Integer.parseInt(sl[0]) Integer.parseInt Integer sl[0] sl 0 int b = Integer.parseInt(sl[1]); b Integer.parseInt(sl[1]) Integer.parseInt Integer sl[1] sl 1 int num = 0; num 0 for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            } int i = a; int i = a; i a i <= b i b i++ i++ i {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            } {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            } if (isPalindromeNumber(String.valueOf(i))) num++; isPalindromeNumber(String.valueOf(i)) isPalindromeNumber String.valueOf(i) String.valueOf String i num++ num System.out.println(num) System.out.println System.out System System.out num String[] args args static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    } isPalindromeNumber {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    } boolean flg = true; flg true if (s.charAt(0) != s.charAt(4)) flg = false; s.charAt(0) != s.charAt(4) s.charAt(0) s.charAt s 0 s.charAt(4) s.charAt s 4 flg = false flg false if (s.charAt(1) != s.charAt(3)) flg = false; s.charAt(1) != s.charAt(3) s.charAt(1) s.charAt s 1 s.charAt(3) s.charAt s 3 flg = false flg false return flg; flg String s s public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
} Main
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String[] sl = s.split(" ");
            int a = Integer.parseInt(sl[0]);
            int b = Integer.parseInt(sl[1]);

            int num = 0;
            for (int i = a; i <= b; i++) {
                if (isPalindromeNumber(String.valueOf(i))) num++;
            }

            System.out.println(num);
        }
    }

    static boolean isPalindromeNumber(String s) {
        boolean flg = true;

        if (s.charAt(0) != s.charAt(4)) flg = false;
        if (s.charAt(1) != s.charAt(3)) flg = false;

        return flg;
    }
}
