import java.io.*;

public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  }
} import java.io.*; io.* java public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  }
} Main public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  } main {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  } try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    } catch (Exception e) {
      System.out.println("error");
    } Exception e {
      System.out.println("error");
    } System.out.println("error") System.out.println System.out System System.out "error" {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String str; str int a a b b i i count = 0; count 0 str = reader.readLine() str reader.readLine() reader.readLine reader a = Integer.parseInt(str.substring(0, 5)) a Integer.parseInt(str.substring(0, 5)) Integer.parseInt Integer str.substring(0, 5) str.substring str 0 5 b = Integer.parseInt(str.substring(6)) b Integer.parseInt(str.substring(6)) Integer.parseInt Integer str.substring(6) str.substring str 6 for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      } i = a; i = a i a i <=b i b i++ i++ i {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      } {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      } if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        } i/10000 == i%10 i/10000 i 10000 i%10 i 10 {
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        } if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          } ((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ((i - i/10000*10000) - i%1000) /1000 ((i - i/10000*10000) - i%1000) (i - i/10000*10000) i i/10000*10000 i/10000 i 10000 10000 i%1000 i 1000 1000 (i%100 - i%10) /10 (i%100 - i%10) i%100 i 100 i%10 i 10 10 {
            count = ++count;
          } count = ++count count ++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) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  }
} public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  }
} Main
import java.io.*;

public class Main{
  public static void main(String[] args) {
    try {
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      String str;
      int a, b, i, count = 0;

      str = reader.readLine();
      a = Integer.parseInt(str.substring(0, 5));
      b = Integer.parseInt(str.substring(6));

      for (i = a; i <=b ; i++ ) {
        if(i/10000 == i%10){
          if(((i - i/10000*10000) - i%1000) /1000 == (i%100 - i%10) /10 ){
            count = ++count;
          }
        }
      }

      System.out.println(count);
    }
    catch (Exception e) {
      System.out.println("error");
    }
  }
}
