import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  } main {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a a b b c[] = new int[5] c new int[5] 5 cnt = 0; cnt 0 a = Integer.parseInt(sc.next()) a Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc b = Integer.parseInt(sc.next()) b Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    } int i = a; int i = a; i a i <= b i b i++ i++ i {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    } {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    } int temp = i; temp i for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        } int j = 4; int j = 4; j 4 j >= 0 j 0 j-- j-- j {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        } {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        } c[j] = temp / (int)Math.pow(10, j) c[j] c j temp / (int)Math.pow(10, j) temp (int)Math.pow(10, j) Math.pow Math 10 j temp = temp % (int)Math.pow(10, j) temp temp % (int)Math.pow(10, j) temp (int)Math.pow(10, j) Math.pow Math 10 j if (c[0] == c[4] && c[1] == c[3])
            cnt++; c[0] == c[4] && c[1] == c[3] c[0] == c[4] c[0] c 0 c[4] c 4 c[1] == c[3] c[1] c 1 c[3] c 3 cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a, b, c[] = new int[5], cnt = 0;
    
    a = Integer.parseInt(sc.next());
    b = Integer.parseInt(sc.next());
    
    for (int i = a; i <= b; i++) {
        int temp = i;
        for (int j = 4; j >= 0; j--) {
            c[j] = temp / (int)Math.pow(10, j);
            temp = temp % (int)Math.pow(10, j);
        }
        if (c[0] == c[4] && c[1] == c[3])
            cnt++;
    }
    
    System.out.println(cnt);
  }
}