#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;
using namespace std;

class Void{ public : Void() { } };
const Void IN;

template<typename T> class BaseType;

/* input */

template<typename T> T in(){
	T res;
	std::cin >> res;
	return res;
}
template<typename T>
istream& operator >> (istream& is, BaseType<T>& a){
	T x;
	is >> x;
	a.set(x);
	return is;
}

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;
}




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

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

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

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

class Bool : public BaseType<bool> {
	public:
		Bool () { }
		Bool(bool b) : BaseType<bool>(b) { }
		Bool(Void IN) : BaseType<bool>(IN) { }

		Bool And(Bool a){ return this->get() and a; };
		Bool Or(Bool a){ return this->get() or a; };
		Bool Xor(Bool a){ return this->get() xor a; };

		template<typename T> T ter(T a, T b){ return this->get() ? a : b; }

		void out(string f = "Yes", string s = "No"){
			std::cout << (this->get() ? f : s) << std::endl;
		}

		template<typename T>
		void out(T a, T b){
			std::cout << (this->get() ? a : b) << std::endl;
		}
};

template<typename T> class Number : public BaseType<T> {
	private:
		Number<T> evalOp(T a, Number<T>(Number::*f)(Number<T>)){
			this->set((this->*f)(a));
			return *this;
		}
	public:
		Number() {}
		Number(T value) : BaseType<T>(value) { }
		Number(Void IN) : BaseType<T>(IN) { }

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

		Number<T> operator += (T a){ return evalOp(a, &Number::add); }
		Number<T> operator -= (T a){ return evalOp(a, &Number::sub); }
		Number<T> operator *= (T a){ return evalOp(a, &Number::pro); }
		Number<T> operator /= (T a){ return evalOp(a, &Number::div); }
		Number<T> operator %= (T a){ return evalOp(a, &Number::mod); }

		Number<T> operator ++ (){ return *this += Number<T>(1); }
		Number<T> operator ++ (T){ return *this += Number<T>(1); }
		Number<T> operator -- (){ return *this -= Number<T>(1); }
		Number<T> operator -- (T){ return *this -= Number<T>(1); }

		Bool eq(Number<T> a){ return this->get() == a; }
		Bool neq(Number<T> a){ return this->get() != a; }
		Bool gt(Number<T> a){ return this->get() > a; }
		Bool gtq(Number<T> a){ return this->get() >= a; }
		Bool lt(Number<T> a){ return this->get() < a; }
		Bool ltq(Number<T> a){ return this->get() <= a; }

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

		Number<T> abs(){ return std::abs(this->get()); }


		Number<T> max(Number<T> a){ return this->get() < a ? a : *this; }
		Number<T> min(Number<T> a){ return this->get() < a ? *this : a; }

};


class String : public BaseType<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:
		String() { }
		String(string s) : BaseType<string>(s) { }
		String(Void IN) : BaseType<string>(IN) { }

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

		//Int stoi(){ return stoi(this->get()); }

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

		Bool eq(String a){ return this->get() == string(a); }
		Bool neq(String a){ return this->get() != string(a); }
		Bool ceq(String a){
			std::set<char> x(all(this->get())), y(all(a));
			return x == y;
		}
		Bool isPal(){
			return palindromCheck();
		}

		char operator [] (int i){
			return this->get().at(i);
		}
};

class Int : public Number<int> {
	public:
		Int() { }
		Int(int i) : Number<int>(i) { }
		Int(Void IN) : Number<int>(IN) { }

		Int sqrt(){ return floor(std::sqrt(this->get())); }
		Int dsum(){
			Int a(this->get()), res(0);
			while(a != 0){
				res+=a.mod(10);
				a/=10;
			}
			return res;
		}

		String itos(){ return String(to_string(this->get())); }
};



/* output */
template<typename S> void out(S 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(vector<vector<T>>& 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);
}


/* algorithm */
template<typename T> T accumulate(vector<T>& a, int s, int t, T sum = 0){
	range(i,s,t) sum += a.at(i);
	return sum;
}



void solve(){
	Int n(IN);
	n.mod(10).eq(1).ter(Int(9),Int(1)).add(n.div(10).mod(10).eq(1).ter(Int(9), Int(1)).pro(10)).add(n.div(100).eq(1).ter(Int(9), Int(1)).pro(100)).out();
}


int main(){
	solve();
}


Measured memory_bytes: 256