#include <bits/stdc++.h>
using namespace std;
int main (){
  int a,b,d,e,A,B,N;
  cin>>A>>B;
  N=0;
  for(int i=A;i<B+1;i++){
    a=i%10;
    b=(i/10)%10;
    d=(i/1000)%10;
    e=(i/10000)%10;
    if(a==e&&b==d){
    N++;
    } 
  }
  cout<<N<<endl;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  ll P[N];
  for(ll i=0;i<N;i++){
    cin >> P[i];
  }
  ll ans = 1;
  ll now = P[0];
  for(ll i=1;i<N;i++){
    if(P[i]<now){
      ans++;
      now = P[i];
    }
  }
  cout << ans << endl;
}
