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

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    }

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.HashSet; HashSet java.util import java.io.PrintWriter; PrintWriter java.io import java.io.OutputStream; OutputStream java.io import java.util.Comparator; Comparator java.util public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    }

} Main // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } inputval {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } String[] strarray = br.readLine().trim().split(" "); strarray br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " int[] intarray = new int[strarray.length]; intarray new int[strarray.length] strarray.length strarray strarray.length for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        } int i = 0; int i = 0; i 0 i < intarray.length i intarray.length intarray intarray.length i++ i++ i {
            intarray[i] = Integer.parseInt(strarray[i]);
        } {
            intarray[i] = Integer.parseInt(strarray[i]);
        } intarray[i] = Integer.parseInt(strarray[i]) intarray[i] intarray i Integer.parseInt(strarray[i]) Integer.parseInt Integer strarray[i] strarray i return intarray; intarray // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    } inputIntList {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    } List<String> strList = Arrays.asList(br.readLine().trim().split(" ")); strList Arrays.asList(br.readLine().trim().split(" ")) Arrays.asList Arrays br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " List<Integer> intList = new ArrayList<Integer>(); intList new ArrayList<Integer>() for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        } String elem strList {
            intList.add(Integer.parseInt(elem));
        } {
            intList.add(Integer.parseInt(elem));
        } intList.add(Integer.parseInt(elem)) intList.add intList Integer.parseInt(elem) Integer.parseInt Integer elem return intList; intList // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } inputvalInteger {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    } String[] strarray = br.readLine().trim().split(" "); strarray br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " Integer[] intarray = new Integer[strarray.length]; intarray new Integer[strarray.length] strarray.length strarray strarray.length for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        } int i = 0; int i = 0; i 0 i < intarray.length i intarray.length intarray intarray.length i++ i++ i {
            intarray[i] = Integer.parseInt(strarray[i]);
        } {
            intarray[i] = Integer.parseInt(strarray[i]);
        } intarray[i] = Integer.parseInt(strarray[i]) intarray[i] intarray i Integer.parseInt(strarray[i]) Integer.parseInt Integer strarray[i] strarray i return intarray; intarray public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    } main {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    } int [] inputval = inputval(); inputval inputval() inputval int a = inputval[0]; a inputval[0] inputval 0 int b = inputval[1]; b inputval[1] inputval 1 int cnt = 0; cnt 0 for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        } int i=a; int i=a; i a i<=b i b i++ i++ i {
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        } {
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        } String si = Integer.toString(i); si Integer.toString(i) Integer.toString Integer i if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            } si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3) si.charAt(0) == si.charAt(4) si.charAt(0) si.charAt si 0 si.charAt(4) si.charAt si 4 si.charAt(1) == si.charAt(3) si.charAt(1) si.charAt si 1 si.charAt(3) si.charAt si 3 {
                cnt++;
            } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    }

} public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Comparator;

public class Main {
    // 標準入力
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    // 標準入力数値配列用 int
    static int[] inputval() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        int[] intarray = new int[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    // 標準入力数値リスト用 int
    static List<Integer> inputIntList() throws Exception {
        List<String> strList = Arrays.asList(br.readLine().trim().split(" "));
        List<Integer> intList = new ArrayList<Integer>();
        for (String elem : strList){
            intList.add(Integer.parseInt(elem));
        }
        return intList;
    }

    // 標準入力数値配列用 integer ソート用
    static Integer[] inputvalInteger() throws Exception {
        String[] strarray = br.readLine().trim().split(" ");
        Integer[] intarray = new Integer[strarray.length];
        for (int i = 0; i < intarray.length; i++) {
            intarray[i] = Integer.parseInt(strarray[i]);
        }
        return intarray;
    }

    public static void main(String[] args) throws Exception {
        // write your code here
        int [] inputval = inputval();
        int a = inputval[0];
        int b = inputval[1];
        int cnt = 0;
        for (int i=a; i<=b; i++){
            String si = Integer.toString(i);
            if (si.charAt(0) == si.charAt(4) && si.charAt(1) == si.charAt(3)){
                cnt++;
            }
        }
        System.out.println(cnt);


    }

}

