import java.io.*;

public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
}
 import java.io.*; io.* java public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
} Main public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  } main {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  } BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1); r new BufferedReader(new InputStreamReader(System.in), 1) String s = r.readLine(); s r.readLine() r.readLine r String sl[] = s.split(" "); sl s.split(" ") s.split s " " int a = Integer.parseInt(sl[0]); a Integer.parseInt(sl[0]) Integer.parseInt Integer sl[0] sl 0 int b = Integer.parseInt(sl[1]); b Integer.parseInt(sl[1]) Integer.parseInt Integer sl[1] sl 1 int v = 0; v 0 for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    } int i = a; int i = a; i a i <= b i b i++ i++ i {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    } {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    } if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      } i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10 i % 10 == i / 10000 i % 10 i 10 i / 10000 i 10000 i / 10 % 10 == i / 1000 % 10 i / 10 % 10 i / 10 i 10 10 i / 1000 % 10 i / 1000 i 1000 10 {
        v++;
      } v++ v System.out.println(v) System.out.println System.out System System.out v String[] args args public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
} public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
} Main
import java.io.*;

public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
}

