import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] a = sc.nextLine().split(" "); a sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int small = Integer.parseInt(a[0]); small Integer.parseInt(a[0]) Integer.parseInt Integer a[0] a 0 int large = Integer.parseInt(a[1]); large Integer.parseInt(a[1]) Integer.parseInt Integer a[1] a 1 int count = 0; count 0 for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        } int i=small ; int i=small ; i small i <= large i large i++ i++ i {
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        } {
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        } int number = i; number i List<Integer> n = new ArrayList<Integer>(); n new ArrayList<Integer>() for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            } int j=0; int j=0; j 0 j<5 j 5 j++ j++ j {
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            } {
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            } int c =number % 10; c number % 10 number 10 n.add(c) n.add n c number = number/10 number number/10 number 10 if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            } n.get(0) == n.get(4) && n.get(1) == n.get(3) n.get(0) == n.get(4) n.get(0) n.get n 0 n.get(4) n.get n 4 n.get(1) == n.get(3) n.get(1) n.get n 1 n.get(3) n.get n 3 {
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
} Main
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] a = sc.nextLine().split(" ");
        int small = Integer.parseInt(a[0]);
        int large = Integer.parseInt(a[1]);
        int count = 0;
        //System.out.println(small +"."+ large);
        for(int i=small ; i <= large ; i++){
            int number = i;
            //System.out.println(number);
            List<Integer> n = new ArrayList<Integer>();
            for(int j=0; j<5 ; j++){
                int c =number % 10;
                n.add(c);
                number = number/10;
                //System.out.println(n.get(j));
            }
            if(n.get(0) == n.get(4) && n.get(1) == n.get(3)){
                count++;
                //System.out.println(n.get(0)+" "+ n.get(4)+" "+ n.get(1) +" "+n.get(3));
            }
        }
        System.out.println(count);
    }
}
