function Main(input) {
  input = input.split(' ');
  num = Number(input[0]);
  lastNum = Number(input[1]);
  count = 0;
  while(num <= lastNum){
    pal = String(num);
    if (pal[0] === pal[4] && pal[1] === pal[3]) {
      count++;
    }
    num++;
  }
  console.log(count);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))