import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    } main {
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i = sc.nextInt(); i sc.nextInt() sc.nextInt sc int j = sc.nextInt(); j sc.nextInt() sc.nextInt sc int k = 0; k 0 for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        } int l = i; int l = i; l i l <= j l j l++ l++ l {
            if(l/1000==l%10*10+l%100/10) k++;
        } {
            if(l/1000==l%10*10+l%100/10) k++;
        } if(l/1000==l%10*10+l%100/10) k++; l/1000==l%10*10+l%100/10 l/1000 l 1000 l%10*10+l%100/10 l%10*10 l%10 l 10 10 l%100/10 l%100 l 100 10 k++ k System.out.println(k) System.out.println System.out System System.out k String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        int k = 0;
        for(int l = i;l <= j;l++){
            if(l/1000==l%10*10+l%100/10) k++;
        }
        System.out.println(k);
    }
}