#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  std::cerr << #x << " = " << (x) << std::endl;

class boolean;
template<typename T> void out(T a);



template<typename T>
class BaseType{
	protected:
		T value;
	public:
		BaseType() { }
		BaseType(T value) : value(value) { }

		bool operator < (const T &right ) const {
			return value < right.get();
		}
		bool operator > ( T &right ) const {
			return value > right.get();
		}

		T get(){ return value; }
		void set(T v){ value = v; }

		void out(){ std::cout << value << std::endl; };
};

template <class C>
class IString : public BaseType<std::string>{
	private:
		bool palindromCheck(){
			int i = 0;
			while(i < this->value.size() - 1 - i){
				int j = this->value.size() - 1 - i;
				if(this->value.at(i) != this->value.at(j)) return false;
				i++;
			}
			return true;
		}
	public:
		IString() { }
		IString(std::string str) : BaseType<std::string>(str) { }

		IString add(IString a){ return IString(this->value + a.get()); }
		IString sort(){
			std::string s = this->value;
			std::sort(all(s));
			return IString(s);
		}

		C eq(IString a){ return this->value == a.get(); }
		C neq(IString a){ return this->value != a.get(); }
		C seq(IString a){
			std::set<char> x, y;
			for(auto i : this->value) x.emplace(i);
			for(auto i : a.get()) y.emplace(i);
			return x == y;
		}
		C isPal(){
			return palindromCheck();
		}

		auto begin(){ return this->value.begin(); }
		auto end(){ return this->value.end(); }
};


template<typename T, class C>
class IValue : public BaseType<T>{
	public:
		IValue() {}
		IValue(T value) : BaseType<T>(value) { }

		IValue<T,C> add(IValue<T,C> a){ return IValue<T,C>(this->get() + a.get()); }
		IValue<T,C> sub(IValue<T,C> a){ return IValue<T,C>(this->get() - a.get()); }
		IValue<T,C> pro(IValue<T,C> a){ return IValue<T,C>(this->get() * a.get()); }
		IValue<T,C> div(IValue<T,C> a){ return IValue<T,C>(this->get() / a.get()); }
		IValue<T,C> mod(IValue<T,C> a){ return IValue<T,C>(this->get() % a.get()); }

		C eq(IValue<T,C> a){ return this->get() == a.get(); }
		C neq(IValue<T,C> a){ return this->get() != a.get(); }
		C gt(IValue<T,C> a){ return this->get() > a.get(); }
		C gtq(IValue<T,C> a){ return this->get() >= a.get(); }
		C lt(IValue<T,C> a){ return this->get() < a.get(); }
		C ltq(IValue<T,C> a){ return this->get() <= a.get(); }

		C even(){ return this->get() % 2 == 0; }
		C odd(){ return this->get() % 2 == 1; }

		IValue<T,C> max(IValue<T,C> a){ return this->get() < a.get() ? a : *this; }
		IValue<T,C> min(IValue<T,C> a){ return this->get() < a.get() ? *this : a; }

		IString<C> vtos(){
			std::string t = std::to_string(this->get());
			return IString<C>(t);
		}

		IValue<T,C> sqrt(){
			for(int i = 1; i * i <= this->get(); i++){
				if(i * i == this->get()) return i;
			}
			return -1;
		}
		IValue<T,C> abs(){ return std::abs(this->get()); }
		C isPal(){
			return IString<C>(vtos()).isPal();
		}
};

class boolean{
	bool b;
	public:
		boolean() { }
		boolean(bool b) : b(b) {}

		void operator = (const bool b){
			this->b = b;
		}

		boolean And(boolean a){ return b and a.get(); };
		boolean Or(boolean a){ return b or a.get(); };
		boolean Xor(boolean a){ return b xor a.get(); };

		template<typename X> IValue<X,boolean> ter(X x, X y){ return b ? x : y; };

		bool get(){ return b; }
		void out(std::string f = "Yes", std::string s = "No"){
			std::cout << (b ? f : s) << std::endl;
		}
};

typedef IString<boolean> String;

/* output */
template<typename T>
std::ostream& operator << (std::ostream& os, BaseType<T> t){
	os << t.get();
	return os;
}
template<typename T> void out(T a){
	std::cout << a << std::endl;
}
template<typename T> void out(std::vector<T> a, bool space = true){
	rep(i,a.size()){
		out(a[i]);
		out(i + 1 == a.size() ? "\n" : (space ? " " : ""));
	}
}
template<typename T> void out(std::vector<std::vector<IValue<T, boolean>>>& v){
	rep(i,v.size()){
		out(v[i]);
	}
}

/* 多重vector */
template <typename X, typename T>
auto vectors(X x, T a) {
	return std::vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return std::vector<decltype(cont)>(x, cont);
}

/* input */
template<typename T>
std::istream& operator >> (std::istream& is, BaseType<T>& t){
	T res;
	is >> res;
	t.set(res);
	return is;
}

template<typename T> T in(){
	T res;
	std::cin >> res;
	return res;
}
template<typename T> std::vector<T> in(int n){
	std::vector<T> res(n);
	rep(i,n) res[i] = in<T>();
	return res;
}
template<typename T> std::vector<std::vector<T>> in(int h, int w){
	std::vector<std::vector<T>> res(h);
	rep(i,h) res[i] = in<T>(w);
	return res;
}
template<typename T> std::set<T> inSet(int n){
	std::set<T> res;
	rep(i,n) res.emplace(in<T>());
	return res;
}

struct Type{
	using T = int;
	static constexpr int Number(){ return 1; }
};

typedef typename Type::T S;
typedef IValue<S,boolean> V;
typedef std::vector<V> Vec;


void solve(){
	Vec a = in<V>(2);

	int ans = 0;
	range(i,a[0].get(),a[1].get() + 1){
		ans += V(i).isPal().get();
	}
	out(ans);
}


int main(){
	solve();
}


Measured memory_bytes: 256