import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a; a int sum =0; sum 0 if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		} N/100==1 N/100 N 100 1 {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		} a = N-100 a N-100 N 100 sum+=900 sum 900 if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			} a/10==1 a/10 a 10 1 {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			} a = a-10 a a-10 a 10 sum+=90 sum 90 if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				} a/1==1 a/1 a 1 1 {
					sum+=9;
				} sum+=9 sum 9 if(a/9==1) {
					sum+=1;
				} a/9==1 a/9 a 9 1 {
					sum+=1;
				} sum+=1 sum 1 if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			} a/10==9 a/10 a 10 9 {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			} a = a-90 a a-90 a 90 sum+=10 sum 10 if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				} a/1==1 a/1 a 1 1 {
					sum+=9;
				} sum+=9 sum 9 if(a/1==9) {
					sum+=1;			
				} a/1==9 a/1 a 1 9 {
					sum+=1;			
				} sum+=1 sum 1 if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		} N/100==9 N/100 N 100 9 {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		} a = N-900 a N-900 N 900 sum+=100 sum 100 if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			} a/10==1 a/10 a 10 1 {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			} a = a-10 a a-10 a 10 sum+=90 sum 90 if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				} a/1==1 a/1 a 1 1 {
					sum+=9;
				} sum+=9 sum 9 if(a/9==1) {
					sum+=1;
				} a/9==1 a/9 a 9 1 {
					sum+=1;
				} sum+=1 sum 1 if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			} a/10==9 a/10 a 10 9 {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			} a = a-90 a a-90 a 90 sum+=10 sum 10 if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				} a/1==1 a/1 a 1 1 {
					sum+=9;
				} sum+=9 sum 9 if(a/1==9) {
					sum+=1;				
				} a/1==9 a/1 a 1 9 {
					sum+=1;				
				} sum+=1 sum 1 System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	}
} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int sum =0;
		if(N/100==1) {
			a = N-100;
			sum+=900;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;			
				}
			}
		}
		if(N/100==9) {
			a = N-900;
			sum+=100;
			if(a/10==1) {
				a = a-10;
				sum+=90;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/9==1) {
					sum+=1;
				}
			}
			else if(a/10==9) {
				a = a-90;
				sum+=10;
				if(a/1==1) {
					sum+=9;
				}
				else if(a/1==9) {
					sum+=1;				
				}
			}
		}
		System.out.println(sum);
	}
}
