#include <bits/stdc++.h>
using namespace std;

int main() {
  int A, B, i, a, b, x, y, z = 0;
  cin >> A >> B;
  for (int i = A; i < B + 1; i++){
    a = i / 10000;
    b = (i / 1000) % 10;
    x = i % 10;
    y = (i % 100) / 10;
    if (a == x && b == y){
      z += 1;
    }
    else
      continue;
  }
  cout << z << endl;
}

#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int n, k;
  cin >> n >> k;
  cout << n - k + 1 << endl;
  return 0;
}