Let's denote a function $f(x)$ in such a way: we add $1$ to $x$, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example,   $f(599) = 6$: $599 + 1 = 600 \rightarrow 60 \rightarrow 6$;  $f(7) = 8$: $7 + 1 = 8$;  $f(9) = 1$: $9 + 1 = 10 \rightarrow 1$;  $f(10099) = 101$: $10099 + 1 = 10100 \rightarrow 1010 \rightarrow 101$. 

We say that some number $y$ is reachable from $x$ if we can apply function $f$ to $x$ some (possibly zero) times so that we get $y$ as a result. For example, $102$ is reachable from $10098$ because $f(f(f(10098))) = f(f(10099)) = f(101) = 102$; and any number is reachable from itself.

You are given a number $n$; your task is to count how many different numbers are reachable from $n$.


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 10^9$).


-----Output-----

Print one integer: the number of different numbers that are reachable from $n$.


-----Examples-----
Input
1098

Output
20

Input
10

Output
19



-----Note-----

The numbers that are reachable from $1098$ are:

$1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1098, 1099$.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
v = []
v.append(n)
p = n + 1
if n == 10:
	print(19)
else:
	while p not in v:
		if p % 10 == 0:
			p //= 10
		else:
			v.append(p)
			p += 1
	print(len(v))


def f(n):
	res = n + 1
	while res % 10 == 0:
		res = res // 10
	return res
x = int(input())
s = []
while x not in s:
	s.append(x)
	x = f(x)
print(len(s))


n = int(input())
s = set()
i = n
ans = 0
while i not in s:
	ans += 1
	s.add(i)
	i += 1
	while i % 10 == 0:
		i //= 10
print(ans)


import sys, collections
n = sys.stdin.readline().rstrip()
arr = list(map(int, n))
cnt = 0
for i in range(len(arr) - 1, 0, -1):
	cnt += 10 - arr[i]
	arr[i - 1] += 1
print(cnt + 9)


def func(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
num = []
while n not in num:
	num.append(n)
	n = func(n)
print(len(num))


n = int(input())
ans = 0
while n >= 10:
	ans += 1
	n += 1
	while n % 10 == 0:
		n /= 10
print(ans + 9)


n = int(input())
S = set()
S.add(n)
while True:
	n += 1
	while n % 10 == 0:
		n //= 10
	if n in S:
		break
	else:
		S.add(n)
print(len(S))


n = int(input())
lst = [n]

def fn(x):
	x += 1
	while x % 10 == 0:
		if x == 0:
			return 0
		else:
			x = x // 10
	return x
while True:
	n = fn(n)
	if n not in lst:
		lst.append(n)
	else:
		print(len(lst))
		break


n = input()
l = [int(i) for i in n]
l = l[::-1]
c = 0
for i in range(len(n) - 1):
	c = c + (10 - l[i])
	l[i + 1] = l[i + 1] + 1
c = c + 9
print(c)


n = int(input())
flag = 0
res = 0
while n >= 10:
	remainer = n % 10 + flag
	flag |= 1
	res += 10 - remainer
	n //= 10
print(res + 9)


def fun(a):
	a += 1
	while a % 10 == 0:
		a //= 10
	return a
a = int(input())
s = set()
s.add(a)
while fun(a) not in s:
	a = fun(a)
	s.add(a)
print(len(s))


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce

def __starting_point():
	n = [int(val) for val in sys.stdin.readline().split()][0]
	count = 0
	s = set([])
	while not n in s:
		s.add(n)
		n += 1
		n = str(n)
		while n[-1] == '0':
			n = n[:-1]
		n = int(n)
		count += 1
	print(count)
__starting_point()


n = int(input())
x = n

def f(n):
	n += 1
	while n % 10 == 0:
		n = n // 10
	return n
l = []
i = 1
while l.count(f(n)) == 0:
	n = f(n)
	l.append(n)
	i += 1
if l.count(x) != 0:
	print(i - 1)
else:
	print(i)


t = input()
r = 0
m = 0
s = set()
s.add(t)
while len(t) > 0 and r != len(s):
	r = len(s)
	m = int(t) + 1
	t = str(m)
	while t[-1] == '0':
		t = t[:-1]
	s.add(t)
print(len(s))


x = int(input())
count = 1
already = [x]
x = x + 1
while True:
	if x % 10 == 0:
		x = x // 10
		continue
	if x not in already:
		already.append(x)
		x = x + 1
	else:
		break
print(len(already))


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
from decimal import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def res(ans, t):
	print('Case #{}: {}'.format(t, ans))

def divi(n):
	l = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l += [i, n // i]
	l.sort()
	return l

def lcm(a, b):
	return a * b // gcd(a, b)
f = 0
n = int(input())
cn = n
se = set()
s = str(n)
if s[-1] == '0':
	f = 1
	n += 1
	se.add(n)
else:
	se.add(n)
while 1:
	s = str(n)
	l = len(s)
	if s[-1] == '0':
		while s[-1] == '0':
			l -= 1
			s = s[:l]
		n = int(s)
		if n in se:
			break
	else:
		n += 1
		s = str(n)
		l = len(s)
		if s[-1] == '0':
			while s[-1] == '0':
				l -= 1
				s = s[:l]
			n = int(s)
		if n in se:
			break
	se.add(n)
if f:
	se.add(cn)
print(len(se))


n = int(input())
c = 0
while n > 9:
	if n > 9:
		n += 1
		c += 1
	while n % 10 == 0:
		n //= 10
print(c + 9)


num = 0
n = int(input())
reach = []
k = n
while k not in reach:
	reach.append(k)
	num = num + 1
	k = k + 1
	while k % 10 == 0:
		k = k // 10
print(num)


def rec(p):
	p += 1
	if p in map:
		return
	map.append(p)
	if p % 10 == 0:
		while p % 10 == 0:
			p /= 10
			p = int(p)
	rec(p)
n = int(input())
map = []
rec(n)
print(len(map))


a = int(input())

def f(a):
	a += 1
	while a % 10 == 0:
		a /= 10
	return a
results = set()
results.add(a)
stop = False
while True:
	if a == 1:
		if stop:
			break
		else:
			stop = True
	a = f(a)
	results.add(a)
print(len(results))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
a = list()
n = int(input())
while n not in a:
	a.append(n)
	n = f(n)
print(len(a))


def f(x):
	x = x + 1
	while x % 10 == 0:
		x = x / 10
	return x
n = int(input())
s = set()
x = n
while x not in s:
	s = s | {x}
	new_x = f(x)
	x = new_x
print(len(s))


def div(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x

def main():
	a = set()
	n = int(input())
	while not n in a:
		a.add(n)
		n = div(n)
	print(len(a))
main()


n = int(input())
ans = 0
while n >= 10:
	temp = 10 - n % 10
	ans += temp
	n += temp
	while not n % 10:
		n //= 10
print(ans + 9)


n = int(input())
l = 0
if n % 10 == 0:
	n += 1
	l += 1
	while n > 10:
		if n % 10 != 0:
			l = l + 1
			n += 1
		else:
			n = n / 10
else:
	while n > 10:
		if n % 10 != 0:
			l = l + 1
			n += 1
		else:
			n = n / 10
print(l + 9)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def solve():
	t = 1
	for tt in range(t):
		n = nu()
		cc = 0
		Pq = 0
		if n >= 10:
			cc = 1
		n += 1
		while n > 10:
			if n % 10 == 0:
				while n % 10 == 0:
					n = n // 10
			if n > 10:
				cc += 1
				n += 1
		cc += 9
		print(cc)
solve()


def f(x):
	global q
	x = x + 1
	while x % 10 == 0 and x != 0:
		x = x // 10
	if x not in q:
		q.add(x)
		f(x)
n = int(input())
q = set()
q.add(n)
f(n)
print(len(q))


a = input()
b = len(a)
print(9 * b - sum(map(int, a[1:])) + (b > 1))


n = int(input())
ans = 0
c = 0
f = 0
while n != c:
	if n % 10 == n and f == 0:
		c = n
		f = 1
	n += 1
	while n % 10 == 0:
		n //= 10
	ans += 1
print(ans)


import sys

def f(x):
	x += 1
	return int(str(x).strip('0'))

def gao(n):
	s = set()
	s.add(n)
	y = f(n)
	while y not in s:
		s.add(y)
		y = f(y)
	return len(s)
for line in sys.stdin:
	line.strip(' \r\n')
	if len(line):
		print(gao(int(line)))


a = int(input())
count = 0
while True:
	if a < 10:
		break
	else:
		a = a + 1
		while a % 10 == 0:
			a = a // 10
		count += 1
print(count + 9)


n = int(input())
l1 = []
l1.append(n)
while 1:
	n += 1
	while n % 10 == 0:
		n = n // 10
	if n not in l1:
		l1.append(n)
	else:
		break
print(len(l1))


n = input()
print(9 + sum((9 - int(d) for d in n[1:])) + (len(n) > 1))


import sys

def solve(n):
	s = str(n)
	if len(s) == 1:
		return 9
	ans = 1
	for i in range(len(s) - 1, -1, -1):
		if i == 0:
			ans += 9
			continue
		k = int(s[i])
		k += 1
		if k == 10:
			continue
		ans += 9 - k + 1
	return ans
n = input()
print(solve(n))


n = int(input())
res = 0
while n >= 10:
	mod = n % 10
	res += 10 - mod
	n = (n + (10 - mod)) // 10
	while n % 10 == 0:
		n = n // 10
res += 9
print(res)


n = int(input())
s = set()
s.add(n)
while True:
	n += 1
	while n % 10 == 0:
		n /= 10
	if n in s:
		break
	s.add(n)
print(len(s))


def f(n):
	n += 1
	while n % 10 == 0:
		n = str(n)
		n = int(n[:len(n) - 1])
	if n in li:
		return
	else:
		li.append(n)
		return f(n)
n = int(input())
count = 0
li = [n]
f(n)
print(len(li))


n = int(input())
if n > 9:
	ans = 10
	while n > 9:
		if str(n)[-1] == '9':
			n += 1
			while str(n)[-1] == '0':
				n //= 10
			if n > 9:
				ans += 1
		else:
			ans += 9 - int(str(n)[-1])
			n += 9 - int(str(n)[-1])
else:
	ans = 9
print(ans)


g = 1
dict = {}

def f(x):
	global dict
	dict[x] = dict.get(x, 0) + 1
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
n = int(input())
while n not in dict or (n + 1 % 10 != 0 and n + 1 not in dict):
	n = f(n)
print(len(dict))


import sys
n = int(sys.stdin.readline())
res = [n]
while True:
	n += 1
	n = int(str(int(str(n)[::-1]))[::-1])
	if n not in res:
		res.append(n)
	else:
		break
print(len(res))


from math import *
n = int(input())
cnt = 0
dict = {}
while True:
	if n in dict:
		break
	cnt += 1
	dict[n] = 1
	n += 1
	while n % 10 == 0:
		n //= 10
print(cnt)


n = int(input())
total = 1
while n >= 10:
	r = 10 - n % 10
	total += r
	n += r
	s = str(n)[::-1]
	while s and s[0] == '0':
		s = s[1:]
	s = s[::-1]
	n = int(s)
if n != 0:
	total += 8
print(total)


def f(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return x
r = set()
n = int(input())
x = n
while x not in r:
	r.add(x)
	x = f(x)
print(len(r))


def f(n):
	n = n + 1
	while n % 10 == 0:
		n = n / 10
	return n
n = int(input())
x = []
c = 0
while x.count(n) == 0:
	x.append(n)
	n = f(n)
	c = c + 1
print(c)


def f(x):
	x += 1
	while x % 10 == 0:
		x = x / 10
	return int(x)
n = int(input())
reachable = {}
while n not in reachable:
	reachable[n] = True
	n = f(n)
print(len(reachable))


n = int(input())
if n < 10:
	print(9)
elif n >= 10:
	c = 0
	s = 0
	while n != 0:
		x = n % 10
		if c == 0:
			s += 10 - x
			c += 1
		elif c > 0:
			s += 10 - x - 1
			k = 10 - x - 1
		n = n // 10
	print(s + 9 - k)


s = set()
n = int(input())
t = n
if t % 10 == 0:
	s.add(t)
	t = t + 1
k = 0
while k != 1:
	if t % 10 != 0:
		if t not in s:
			s.add(t)
		else:
			k = 1
		t = t + 1
	else:
		t = int(t / 10)
print(len(s))


n = int(input())
sl = [n]
while True:
	s = str(n + 1)
	while s[-1] == '0':
		s = s[:-1]
	n = int(s)
	if (n in sl) == False:
		sl.append(n)
	else:
		break
print(len(sl))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	d = {}
	if n // 10 == 0:
		d[n] = 1
	cnt = 1
	n += 1
	while n != 1:
		if n % 10 != 0:
			if n // 10 == 0:
				for i in range(n, 10):
					d[i] = 1
			cnt += 10 - n % 10
			n = n // 10
			n += 1
		else:
			n = n // 10
	for i in range(1, 10):
		if i not in d:
			cnt += 1
	print(cnt)
testcase(1)


s = input()
n = s
count = 0

def f(s):
	y = len(s) - 1
	while y >= 0:
		if s[y] != '0':
			return s[:y + 1]
		y -= 1
while len(s) > 0:
	if len(s) == 1:
		count += 9
		s = ''
	else:
		c = 10 - int(s[-1])
		count += c
		s = f(str(int(s) + c))
print(count)


import sys

def is_last_digit_zero(n):
	return n % 10 == 0

def remove_zero(n):
	n = str(n)
	if n[-1] == '0':
		n = n[:-1]
		n = remove_zero(n)
	return int(n)
n = sys.stdin.readline()
n = int(n)
result = []
result.append(n)
while True:
	n += 1
	if is_last_digit_zero(n):
		n = remove_zero(n)
	if n in result:
		break
	else:
		result.append(n)
print(len(result))


darling = {}
x = int(input())
ans = 0
while x not in darling:
	darling[x] = 1
	ans += 1
	x += 1
	while x % 10 == 0:
		x /= 10
print(ans)


n = int(input())
s = set()
s.add(n)
while n != 1:
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	s.add(n)
for i in range(2, 10):
	s.add(i)
print(len(s))


def Del(N):
	B = True
	while B:
		if N % 10 == 0:
			N /= 10
		else:
			return N
n = int(input())
Bool = True
D = {}
count = 0
while Bool:
	if n in D:
		break
	else:
		D[n] = 1
	n += 1
	n = Del(n)
	count += 1
print(count)


from collections import defaultdict

def reachable_numbers(n):
	cnt = 0
	s = defaultdict(bool)
	while not s[n]:
		s[n] = 1
		cnt += 1
		n += 1
		while n % 10 == 0:
			n = n / 10
	return cnt
n = int(input())
print(reachable_numbers(n))


def reachableCount(n):
	bag = set()
	bag.add(n)
	while True:
		n += 1
		while n % 10 == 0:
			n //= 10
		if n in bag:
			break
		bag.add(n)
	return len(bag)
n = int(input())
print(reachableCount(n))


n = int(input())
numbers = set()
while n not in numbers:
	numbers.add(n)
	n += 1
	while n % 10 == 0:
		n /= 10
print(len(numbers))


def f(i):
	if (i + 1) % 10 == 0:
		t = (i + 1) // 10
		while t % 10 == 0:
			t = t // 10
		return t
	else:
		return i + 1

def find(l, x):
	for i in l:
		if i == x:
			return False
	return True
n = int(input())
res = 0
temp = n
l = []
while find(l, temp):
	l.append(temp)
	temp = f(temp)
	res = res + 1
print(res)


n = int(input())
ans = []
while len(ans) == len(set(ans)):
	n += 1
	ans.append(n)
	if str(n)[-1] == '0':
		n = str(n)
		n = n.strip('0')
		n = int(n)
print(len(set(ans)))


n = input()
st = []
st.append(n)
f = 0
while 1:
	if n[len(n) - 1] != '0' or f == 0:
		t = int(n) + 1
		n = str(t)
		f = 1
		if n[len(n) - 1] != '0' and n not in st:
			st.append(n)
		elif n in st:
			break
	else:
		p = n.rstrip('0')
		n = p
		if n not in st:
			st.append(n)
		else:
			break
if '1' not in st:
	st.append('1')
print(len(st))


def filter(n):
	d = str(n)
	for i in range(len(str(n))):
		if d[-1] == '0':
			d = d[:-1]
		else:
			break
	return d
st = int(input())
if st >= 10:
	add = True
else:
	add = False
num = set()
for i in range(92):
	a = st + 1
	num.add(filter(a))
	st = int(filter(a))
if add:
	print(len(num) + 1)
else:
	print(len(num))


n = int(input())
ans = [n]

def f(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	if n in ans:
		return
	ans.append(int(n))
	f(n)
f(n)
print(len(ans))


n = int(input())
ans = 0
while n > 9:
	div = 9 - n % 10 + 1
	ans += div
	if n < 10:
		break
	n += div
	while n and n % 10 == 0:
		n = n // 10
print(ans + 9)


n = input()
if len(n) == 1 and n != '0':
	print(9)
else:
	N = 10
	for i in n[1:]:
		N += 10 - (int(i) + 1)
	print(N)


n = int(input())
l1 = [n]

def remove0s(a):
	while a % 10 == 0:
		a = a // 10
	return a

def recfun(a):
	a += 1
	if a % 10 == 0:
		a = remove0s(a)
	if a in l1:
		return
	l1.append(a)
	return recfun(a)
recfun(n)
print(len(l1))


def f(x):
	n = x + 1
	while n % 10 == 0:
		n = n / 10
	return n
n = int(input())
l = [n]
x = f(n)
while x not in l:
	l = l + [x]
	x = f(x)
print(len(l))


def fn(x):
	x += 1
	while x % 10 == 0:
		x = x / 10
	return int(x)
n = int(input())
h = {}
c = 0
while n not in h:
	h[n] = 1
	c += 1
	n = fn(n)
print(c)


n = int(input())
c = 9
while n >= 10:
	d = 10 - n % 10
	n += d
	c += d
	while n % 10 == 0:
		n //= 10
print(c)


def f(x):
	x = x + 1
	n = int(str(x)[::-1])
	n = str(n)[::-1]
	return int(n)
x = int(input())
L = []
while x not in L:
	L.append(x)
	x = f(x)
print(len(L))


a = int(input())

def f(a):
	a += 1
	while a % 10 == 0:
		a = a / 10
	return a
x = [a]
while a >= 10:
	a = f(a)
	x.append(a)
print(len(x) + 8)


def function(n):
	n = n + 1
	while n % 10 == 0:
		n = n / 10
	return n
n = int(input())
reached = [n]
number = function(n)
while number not in reached:
	reached.append(number)
	number = function(number)
print(len(reached))


x = int(input())
a = []
while not x in a:
	a.append(x)
	x += 1
	while x % 10 == 0:
		x = x // 10
print(len(a))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
n = int(input())
ach = {n}
x = f(n)
while x not in ach:
	ach.add(x)
	x = f(x)
print(len(ach))


n = int(input())
s = set()

def f(a):
	a += 1
	while a and a % 10 == 0:
		a //= 10
	if a in s:
		return False
	s.add(a)
	return f(a) and f(f(a))
s.add(n)
f(n)
print(len(s))


(Answers, Number) = ([], int(input()))
while True:
	Answers.append(Number)
	Number += 1
	Number = int(str(Number).strip('0'))
	if Number in Answers:
		break
print(len(Answers))


x = int(input())
s = set()
while not x in s:
	s.add(x)
	x = x + 1
	while x % 10 == 0:
		x //= 10
print(len(s))


n = int(input())

def f(n):
	n += 1
	flag = False
	while flag == False:
		if n % 10 == 0:
			n = n // 10
		else:
			flag = True
	return n
count = 1
store = [n]
while n > 0:
	if f(n) in store:
		n = 0
		print(count)
	else:
		store.append(f(n))
		count += 1
		n = f(n)


import sys
import math
import bisect

def solve(n):
	A = set()
	while n not in A:
		A.add(n)
		n += 1
		s = str(n)
		while s[-1] == '0':
			s = s[:-1]
		n = int(s)
	return len(A)

def main():
	n = int(input())
	print(solve(n))
main()


n = int(input())
contados = list()
qtdUm = 0
while qtdUm < 2:
	if n not in contados:
		contados.append(n)
	n = n + 1
	while n % 10 == 0:
		n /= 10
		if n == 1:
			qtdUm += 1
print(len(contados))


from collections import defaultdict
d = defaultdict(int)
counter = 0
n = int(input().strip())
for i in range(1, len(str(n)) + 1):
	d[i] = 0

def funct(n, d, counter):
	if len(str(n)) == 1:
		counter += 9
		return counter
	elif d[len(str(n))] < 9:
		if d[len(str(n))] == 0:
			counter += 9 - n % 10 + 1
		else:
			counter += 9 - d[len(str(n))]
		d[len(str(n))] = 9
		n = n + (10 - n % 10)
		while n % 10 == 0:
			n = n // 10
		counter = funct(n, d, counter)
	return counter
counter = funct(n, d, counter)
print(counter)


num = int(input())
possibles = set()

def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
possibles.add(num)
while num != 1:
	num = f(num)
	possibles.add(num)
possibles.update(list(range(1, 10)))
print(len(possibles))


def f(x):
	x += 1
	y = str(x)
	while y[-1] == '0':
		y = y[:-1]
	return int(y)
x = int(input())
z = 0
y = f(x)
a = []
while x != y and x not in a:
	z += 1
	a.append(x)
	x = y
	y = f(x)
print(z)


n = int(input())
cnt = 0
while n % 10 == 0:
	n += 1
	cnt += 1
while n > 9:
	if n % 10 != 0:
		n += 1
		cnt += 1
	else:
		while n % 10 == 0:
			n //= 10
print(cnt + 9)


def f(x):
	res = x + 1
	while res % 10 == 0:
		res = res / 10
	return res
n = int(input())
st = set()
st.add(n)
res = 1
while 1:
	n = f(n)
	if n in st:
		break
	else:
		st.add(n)
		res = res + 1
print(res)


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
st = set()
n = int(input())
while not n in st:
	st.add(n)
	n = f(n)
print(len(st))


def remove_trailing_zeros(n):
	while True:
		if n % 10 == 0:
			n = n / 10
		else:
			break
	return n
n = int(input())
result = [n]
while True:
	n = n + 1
	n = remove_trailing_zeros(n)
	if n in result:
		break
	else:
		result.append(n)
print(len(result))


n = int(input())
ans = 0
while n >= 10:
	tmp = n % 10
	tmp = 10 - tmp
	ans += tmp
	n += tmp
	while n > 0 and n % 10 == 0:
		n //= 10
ans += 9
print(ans)


l = set()
cur = int(input())
while not cur in l:
	l.add(cur)
	i = cur + 1
	while i % 10 == 0:
		i //= 10
	cur = i
print(len(l))


n = int(input())
kk = dict()
kk[n] = 1
c = 1
while n > 0:
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	if kk.get(n) == None:
		kk[n] = 1
		c += 1
	else:
		break
print(c)


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(1):
	n = int(input())
	v = set()
	l = [n]
	while len(l) > 0:
		t = l.pop()
		if t in v:
			continue
		else:
			v.add(t)
			t += 1
			while t % 10 == 0:
				t = t // 10
			l.append(t)
	print(len(v))


ar = []
n = int(input())
ar.append(n)
count = 1
while count == 1:
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n = n // 10
	if n not in ar:
		ar.append(n)
		count = 1
	else:
		count = 0
		break
print(len(ar))


n = int(input())
s = set()
while n not in s:
	s.add(n)
	n += 1
	while n > 0 and n % 10 == 0:
		n = n // 10
print(len(s))


n = int(input())
d = set()
i = 0
while i < 100000:
	d.add(n)
	n += 1
	while n % 10 == 0:
		n //= 10
	i += 1
print(len(d))


s = input()
c = 9
for i in s[1:]:
	c = c + (9 - int(i))
if len(s) > 1:
	print(c + 1)
else:
	print(c)


n = int(input())
count = 9
digits = [int(x) for x in str(n)]
if len(digits) > 1:
	count += 1
for i in digits[1:]:
	count += 9 - i
print(count)


def f(num):
	tmp = num + 1
	for _ in range(10):
		if tmp % 10 != 0:
			break
		tmp = tmp // 10
	return tmp
n = int(input())
s = set([n])
tmp = f(n)
while 1:
	if tmp in s:
		break
	s.add(tmp)
	tmp = f(tmp)
print(len(s))


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()

def f(x):
	x += 1
	x = str(x)
	while x[-1] == '0':
		x = x[:-1]
	return int(x)
ans = 1
temp = n
mm = {n}
n = f(n)
while n not in mm:
	mm |= {n}
	n = f(n)
	ans += 1
print(ans)


from collections import defaultdict
n = int(input())
d = defaultdict(int)
c = 1
d[n] = 1
while True:
	n = n + 1
	while n % 10 == 0:
		n = n / 10
	if d[n] == 1:
		break
	else:
		d[n] = 1
		c += 1
print(c)


import itertools
a = int(input())
r = []
for x in itertools.accumulate(itertools.count(a), lambda x, _: int(str(x + 1).strip('0'))):
	if x not in r:
		r.append(x)
	else:
		print(len(r))
		break


def func(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return x
x = int(input())
s = set()
while not s.__contains__(x):
	s.add(x)
	x = func(x)
print(s.__len__())


from sys import stdin
input = stdin.readline
s = input().strip()
if len(s) == 1:
	print(9)
else:
	print(9 * len(s) - sum([int(i) for i in list(s)][1:]) + 1)


def func(n):
	re = n + 1
	while re % 10 == 0:
		re //= 10
	return re
n = int(input())
group = set()
while n not in group:
	group.add(n)
	n = func(n)
print(len(group))


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
lol = set()
while t not in lol:
	lol.add(t)
	t += 1
	while t % 10 == 0:
		t //= 10
print(len(lol))


x = int(input())
y = x
counter = 1
known = [y]
while 1:
	y = y + 1
	y = int(str(int(str(y)[::-1]))[::-1])
	if y in known:
		break
	known.append(y)
	counter += 1
print(counter)


a = int(input())

def stran():
	global a
	a += 1
	while a % 10 == 0:
		a = a // 10
	return a
our = []
our.append(a)
while stran() not in our:
	our.append(a)
print(len(our))


def f(x):
	x = x + 1
	if x % 10 != 0:
		return x
	else:
		while x % 10 == 0:
			x /= 10
		return x
n = int(input())
anslist = [n]
while True:
	n = f(n)
	if n in anslist:
		break
	else:
		anslist.append(n)
print(len(anslist))


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
marked = set()
answer = 0
while n not in marked:
	marked.add(n)
	n = f(n)
	answer += 1
print(answer)


n = int(input())

def f(n):
	m = n + 1
	done = True
	while done:
		if m % 10 == 0:
			m = m // 10
		else:
			done = False
	return m
lst = []
temp = n
while not temp in lst:
	lst.append(temp)
	temp = f(temp)
print(len(lst))


a = 0

def f(n, count):
	count += 1
	d.append(n)
	n += 1
	while n % 10 == 0:
		n /= 10
	return (n, count)
n = int(input())
d = []
while n not in d:
	(n, a) = f(n, a)
print(a)


n = int(input())
l = {n}
if n % 10 == 0:
	n += 1
i = 0
while i < 92:
	if n % 10 == 0:
		n //= 10
	else:
		l.add(n)
		n += 1
		i += 1
print(len(l))


n = int(input())

def f(x):
	y = x + 1
	while y % 10 == 0:
		y = y / 10
	return int(y)
L = []
while n not in L:
	L.append(n)
	n = f(n)
S = set(L)
print(len(S))


def dad(n, s):
	if n not in s:
		s.add(n)
	return s
n = int(input())
s = set({n})
n += 1
for i in range(10000):
	if n % 10 == 0:
		n //= 10
		continue
	dad(n, s)
	n += 1
print(len(s))


def f(x):
	x = x + 1
	x = str(x)
	x = x.strip('0')
	return int(x)
x = int(input())
res = set()
while x not in res:
	res.add(x)
	x = f(x)
print(len(res))


def solution(n):
	counter = 0
	if len(n) == 1:
		counter = 9
	else:
		counter = 10
	for i in range(1, len(n)):
		t = int(n[i])
		counter += 9 - t
	return counter
n = input()
print(solution(n))


n = int(input())
count = 9
if len(str(n)) > 1:
	count += 10 - n % 10
	n = n // 10
	for i in range(len(str(n)) - 1):
		count += 9 - n % 10
		n = n // 10
print(count)


n = int(input())
rez = []
i = 0
while n not in rez:
	i += 1
	rez.append(n)
	n += 1
	while n % 10 == 0:
		n //= 10
print(i)


s = input()
n = len(s)
print(sum(map(lambda x: 9 - int(x), s[1:])) + (n != 1) + 9 + (s == '0'))


n = int(input())
s = set()
if n % 10 == 0:
	s.add(n)
	s.add(n + 1)
	n += 2
while n not in s:
	if n % 10 != 0:
		s.add(n)
	n += 1
	while n % 10 == 0:
		n = n // 10
print(len(s))


n = int(input())
s = 1
a = {n}
if n == 0:
	s = 0
while s == s:
	n += 1
	if n % 10 != 0:
		if n not in a:
			a.add(n)
		else:
			break
	else:
		while n % 10 == 0:
			n = n // 10
		if n not in a:
			a.add(n)
		else:
			break
print(len(a))


def func(number):
	new = number + 1
	while new > 0 and new % 10 == 0:
		if new % 10 == 0:
			new = int(new / 10.0)
	return new

def solve_old(num):
	results = set([num])
	new_num = func(num)
	while new_num not in results:
		results.add(new_num)
		new_num = func(new_num)
	results.add(new_num)
	return len(results)

def solve(num):
	new = num
	counter = 0
	while new > 10:
		rem = 10 - new % 10 if new % 10 != 0 else 0
		counter += rem
		new = int((new + rem) / 10.0)
	return counter + 9
num = int(input())
print(solve_old(num))


n = int(input())
ans = 9
while len(str(n)) > 1:
	k = 10 - int(str(n)[-1])
	ans += k
	n += k
	while str(n)[-1] == '0':
		n //= 10
print(ans)


n = list(input())
ans = 0
for i in range(len(n)):
	ans += 10 - int(n[i]) - 1
ans += int(n[0])
if len(n) == 1:
	ans -= 1
print(ans + 1)


n = int(input())
ans = 0
while True:
	if n < 10:
		break
	n += 1
	while n % 10 == 0:
		n /= 10
	ans += 1
print(ans + 9)


def my_fun(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x

def mystery(n):
	a = set()
	while not n in a:
		a.add(n)
		n = my_fun(n)
	return len(a)
print(mystery(int(input())))


n = int(input())
d = {}
d[n] = True
while True:
	n += 1
	while n % 10 == 0:
		n = n // 10
	if n in d:
		break
	d[n] = True
print(len(d.keys()))


def ch(a):
	a = a + 1
	w = str(a)
	e = ''
	pos = 0
	for i in range(len(w) - 1, -1, -1):
		if w[i] != '0':
			pos = i
			break
	for i in range(pos + 1):
		e += w[i]
	return int(e)
a = int(input())
f = set()
ii = a
while ii not in f:
	f.add(ii)
	ii = ch(ii)
print(len(f))


import sys

def ne(x):
	x += 1
	while x > 0 and x % 10 == 0:
		x //= 10
	return x
s = set()
n = int(input())
s.add(n)
while True:
	n = ne(n)
	if n in s:
		print(len(s))
		sys.exit()
	s.add(n)


def f(n):
	n += 1
	return int(str(n).strip('0'))
n = int(input())
c = 0
while n >= 10:
	c += 1
	n = f(n)
print(c + 9)


def func(input):
	input += 1
	while input % 10 == 0:
		input = input / 10
	return input
y = int(input())
if y < 10:
	print(9)
else:
	count = 0
	while y >= 10:
		y = func(y)
		count += 1
	print(count + 9)


n = int(input())

def f(x):
	x += 1
	return int(str(x).strip('0'))
s = set([n])
while True:
	n = f(n)
	if n in s:
		break
	s.add(n)
print(len(s))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
n = int(input())
ans = []
while n not in ans:
	ans.append(n)
	n = f(n)
print(len(ans))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
num = int(input())
visit = set()
while num not in visit:
	visit.add(num)
	num = f(num)
print(len(visit))


a = int(input())
ans = 1
while a // 10 > 0:
	a += 1
	while a % 10 == 0:
		a //= 10
	ans += 1
print(ans + 8)


n = int(input())
ctr = 0
l = []
while n not in l:
	l.append(n)
	n = n + 1
	while n % 10 == 0:
		n = n / 10
	ctr = ctr + 1
print(ctr)


import math, sys

def reach(n, s):
	if len(str(n)) == 1:
		return s + 9
	else:
		while n % 10 != 0:
			s += 1
			n += 1
		return reach(n // 10, s)
n = int(input())
if n < 10:
	print(9)
else:
	print(reach(n + 1, 1))


n = int(input())
vis = dict()
vis[n] = 1

def go(u):
	u += 1
	while u % 10 == 0:
		u //= 10
	return u
for i in range(100000):
	n = go(n)
	vis[n] = 1
print(len(vis))


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
pe = 0
while len(str(n)) != 1:
	n = f(n)
	pe += 1
print(pe + 9)


def f(x):
	if x % 10 == 0:
		return x // 10
	else:
		return False
n = int(input())
check = 0
count = 0
a = str(n)
if a[len(a) - 1] == '0':
	n += 1
	count += 1
while n >= 10:
	if f(n) == False:
		count += 1
		n += 1
	else:
		n = f(n)
print(count + 9)


from collections import defaultdict
from math import log2, floor, sqrt
from pprint import pprint
mod = pow(10, 9) + 7
dict = defaultdict(int)

def ahead(n):
	if n % 10 == 0:
		return ahead(n // 10)
	return n

def fun(n):
	if dict[n] == 0:
		dict[n] = 1
		fun(ahead(n + 1))
n = int(input())
fun(n)
print(len(dict))


n = int(input())
if n < 10:
	print(9)
	exit(0)
c = 1
n += 1
while True:
	if n < 10:
		c += 9
		break
	if n % 10 != 0:
		c += 1
		n += 1
	else:
		n = n // 10
print(c)


n = int(input())

def f(x):
	a = x + 1
	while a % 10 == 0:
		a = a / 10
	return a
S = {n}
while f(n) not in S:
	S = S | {f(n)}
	n = f(n)
print(len(S))


n = int(input())
count = 0
while n >= 10:
	rem = 10 - n % 10
	n += rem
	count += rem
	while n % 10 == 0:
		n //= 10
print(count + 9)


n = int(input())
c = 1
l = []
l.append(n)
q = 1
while q:
	n = n + 1
	while n:
		if n % 10 == 0:
			n = n // 10
		else:
			break
	if n not in l:
		l.append(n)
	else:
		q = 0
print(len(l))


def delete_right_zeros(n):
	ch = str(n)
	while ch[len(ch) - 1] == '0':
		ch = ch[0:len(ch) - 1]
	return int(ch)
n = int(input())
if n <= 9:
	print(9)
	exit()
res = 0
while n >= 10:
	res = res + 1
	n = n + 1
	n = delete_right_zeros(n)
print(res + 9)


def f(n):
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	return n
n = int(input())
d = {}
d[n] = 1
ans = []
ans.append(n)
while f(n) not in d.keys():
	ans.append(f(n))
	d[f(n)] = 1
	n = f(n)
print(len(ans))


def f(x):
	x = str(x)
	y = ''
	fi = 0
	for i in range(len(x) - 1, -1, -1):
		if not x[i] == '0':
			fi = i
			break
	for i in range(fi + 1):
		y += x[i]
	return int(y)
n = int(input())
c = 0
while not n < 10:
	c += 10 - n % 10
	n += 10 - n % 10
	n = f(n)
print(c + 9)


import math

def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
n = int(input())
c = 0
s = 0
if n < 10:
	print(9)
else:
	c = 9
	while n >= 10:
		n = f(n)
		c += 1
	print(c)


n = eval(input())
m = 0
while True:
	if n in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
		m += 9
		break
	else:
		n += 1
		n = str(n)
		n = n.strip('0')
		n = eval(n)
		m += 1
print(m)


n = int(input())
array = [n]
if n % 10 == 0:
	n = n + 1
	array.append(n)
while True:
	last = n % 10
	if last == 0:
		n = n // 10
	else:
		n += 1
		while n % 10 == 0:
			n = n // 10
	if n in array:
		break
	array.append(n)
print(len(array))


n = int(input())
if n < 10:
	print(9)
	exit(0)
count = 10
while n > 9:
	count += 9 - n % 10
	n //= 10
print(count)


n = int(input())
contenedor = {}
contenedor[n] = n
while True:
	n += 1
	while n % 10 == 0:
		n /= 10
	if n in contenedor:
		break
	contenedor[n] = n
print(len(contenedor))


f = lambda x: int(str(x + 1).rstrip('0'))
s = set()
n = int(input())
while n not in s:
	s.add(n)
	n = f(n)
print(len(s))


def func(a):
	a = a + 1
	while a % 10 == 0:
		a = a // 10
	return a
n = int(input())
a = set()
while n not in a:
	a.add(n)
	n = func(n)
print(len(a))


import sys
input = sys.stdin.readline
n = int(input())
visited = set()

def f(n):
	n = n + 1
	while n % 10 == 0:
		n /= 10
	return n
ans = 0
while f(n) not in visited:
	visited.add(n)
	n = f(n)
	ans += 1
print(ans + 1)


def func(num):
	sin = set()
	while not num in sin:
		sin.add(num)
		num += 1
		while num % 10 == 0:
			num /= 10
	print(len(sin))
func(int(input()))


import sys
from collections import defaultdict
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
n = int(input())
myset = set([n])
for i in range(91):
	n += 1
	while n % 10 == 0:
		n //= 10
	myset.add(n)
print(len(myset))


n = int(input())
ct = 0
l = []
while n > 0:
	ct += 1
	l.append(n)
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	if n in l:
		break
print(ct)


def check(n):
	while n % 10 == 0:
		n //= 10
	return n
a = []
n = int(input())
while n not in a:
	a.append(n)
	n = check(n + 1)
print(len(a))


def f(x):
	s = str(x + 1)
	i = len(s) - 1
	while s[i] == '0':
		i -= 1
	return int(s[:i + 1])

def test_f():
	assert 6 == f(599)
	assert 8 == f(7)
	assert 1 == f(9)
	assert f(10099) == 101
x = int(input())
s = {x}
while f(x) not in s:
	x = f(x)
	s.add(x)
print(len(s))


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = eval(input())
a = [n]
while not f(n) in a:
	a.append(f(n))
	n = f(n)
print(len(a))


n = int(input())
digt = []
while 1:
	if n not in digt:
		digt.append(n)
	else:
		exit(print(len(digt)))
	n += 1
	while n % 10 == 0:
		n //= 10


n = input()
n = int(n)
count = 1
one_ten = list(range(1, 10))
while n not in one_ten:
	n += 1
	n = str(n)
	if n[-1] == '0':
		while n[-1] == '0':
			l = len(n)
			n = n[0:l - 1]
		count += 1
		n = int(n)
	else:
		count += 1
		n = int(n)
		continue
count += 8
print(count)


n = input()
l = list(n)
l = list(map(int, l))
if len(l) == 1:
	print(9)
else:
	print(9 * len(l) - sum([int(i) for i in list(l)][1:]) + 1)


x = int(input())

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
d = set()
while not x in d:
	d.add(x)
	x = f(x)
print(len(d))


from sys import stdin
from collections import defaultdict as dd
from collections import deque as dq
import itertools as it
from math import sqrt, log, log2
from fractions import Fraction
n = int(input())
seen = set()
seen.add(n)
while True:
	n += 1
	while n % 10 == 0:
		n //= 10
	if n in seen:
		print(len(seen))
		exit()
	seen.add(n)


x = input()
if len(x) == 1:
	print(9)
	exit()
count = 10
for s in x[1:]:
	count += 9 - int(s)
print(count)


a = list(map(int, list(input())))
if len(a) == 1:
	print(9)
	exit()
ans = 19 - a[-1]
for i in a[1:-1]:
	ans += 10 - i - 1
print(ans)


def f(n):
	n += 1
	n = str(n)
	cut = len(n)
	for i in n[::-1]:
		if i != '0':
			break
		cut -= 1
	n = int(n[:cut])
	return n
while True:
	try:
		ans = 1
		done = {}
		n = int(input())
		n2 = n
		while True:
			if n2 < 10:
				ans = 9
				break
			n = f(n)
			if n not in done:
				ans += 1
				done[n] = True
			else:
				break
		print(ans)
	except EOFError:
		break


def f(n, start):
	if n < 10:
		return 9
	if n % 10 == 0 and (not start):
		return f(n / 10, False)
	else:
		return 1 + f(n + 1, False)
n = int(input())
print(f(n, True))


n = int(input())
z = set()
while not n in z:
	z.add(n)
	n += 1
	while not n % 10:
		n //= 10
print(len(z))


n = int(input())
NUM = 0
n += 1
if n > 10:
	n -= 1
	while 10 <= n:
		en = n % 10
		NUM += 10 - en
		n = int(n // 10)
		n += 1
		while n % 10 == 0:
			n = int(n // 10)
	NUM += 9
else:
	NUM = 9
print(int(NUM))


def reduceTrailing0(n, counter):
	while n == 10 * (n // 10):
		n //= 10
	return n

def foundSecondTime(n):
	if foundSecondTime.boolean == True and n == foundSecondTime.num:
		return False
	if n == foundSecondTime.num:
		foundSecondTime.boolean = True
	return True
foundSecondTime.boolean = False
counter = 0
n = int(input())
foundSecondTime.num = n
reduceTrailing0(n, counter)
boolValue = True
while foundSecondTime(n) == True:
	if n < 10 and boolValue == True:
		boolValue = False
		foundSecondTime.num = n
	counter += 1
	n = n + 1
	n = reduceTrailing0(n, counter)
print(counter)


n = int(input())
cnt = 0
ha = {}
while n:
	tmp = n + 10 - n % 10
	for i in range(n, tmp):
		if not i in ha.keys():
			ha[i] = 1
			cnt += 1
	while tmp % 10 == 0:
		tmp //= 10
	if n == tmp:
		break
	n = tmp
print(cnt)


def f(x):
	val = x + 1
	while val % 10 == 0:
		val = val // 10
	return val
n = int(input())
ans = 1
v = f(n)
while v >= 10:
	ans += 1
	v = f(v)
ans += 9
if n < 10:
	print('9')
else:
	print(ans)


N = int(input())
l = list()
while True:
	if N not in l:
		l.append(N)
		N += 1
		while N % 10 == 0:
			N //= 10
	else:
		break
print(len(l))


import math
n = int(input())
cnt = 0
arr = []
while cnt != 2:
	old = n
	n = n + (10 - n % 10)
	arr.append((old, n))
	if n / 10 == n // 10:
		n = int(str(n).strip('0'))
	if n == 1:
		cnt += 1
arr = list(set(arr))
arr.sort()
delete = []
for i in range(len(arr)):
	for j in range(i + 1, len(arr)):
		if arr[i][0] <= arr[j][0] < arr[i][1]:
			delete.append(j)
flag = 0
for i in delete:
	del arr[i + flag]
	flag += 1
cnt = 0
for i in arr:
	cnt += i[1] - i[0]
print(cnt)


seti = set()
i = int(input())
while i not in seti:
	seti.add(i)
	i += 1
	if list(str(i))[-1] == '0':
		count = 0
		for j in str(i)[::-1]:
			if j != '0':
				break
			else:
				count += 1
		i = int(str(i)[:len(str(i)) - count])
print(len(seti))


def f(b):
	b += 1
	while b % 10 == 0:
		b /= 10
	return b
n = int(input())
s = set()
while n not in s:
	s.add(n)
	n = f(n)
print(len(s))


def f(x):
	x += 1
	while str(x)[-1] == '0':
		x = int(str(x)[:-1])
	return x
n = int(input())
seen = set()
seen.add(n)
x = f(n)
while x not in seen:
	seen.add(x)
	x = f(x)
print(len(seen))


t = int(input())
k = set()
l = 1
k.add(t)
while 1 == 1:
	t += 1
	while t % 10 == 0:
		t = t // 10
	k.add(t)
	l += 1
	if l != len(k):
		break
print(l - 1)


n = int(input())
count = 0
num = n
lst = []
while True:
	lst.append(num)
	num = num + 1
	while num % 10 == 0:
		num = num // 10
	count = count + 1
	if num in lst:
		print(count)
		break


n = int(input())
count = 1
c = 0
while True:
	d = n % 10
	d = 10 - d
	count += d
	n += d
	if n == 10:
		c = n - d
		if c == 0:
			count += c - 1
			break
		count += c - 2
		break
	while n % 10 == 0:
		n /= 10
print(int(count))


x = int(input())
l1 = []
y = x + 1
l1.append(x)
l1.append(y)
while y != -1:
	if y % 10 == 0:
		while y % 10 == 0:
			y = y / 10
	else:
		y = y + 1
		if y % 10 == 0:
			while y % 10 == 0:
				y = y / 10
	if y in l1:
		break
	else:
		l1.append(y)
for i in l1:
	if i % 10 == 0:
		l1.remove(i)
if x in l1:
	print(len(l1))
else:
	print(len(l1) + 1)


import sys
from bisect import bisect_left, bisect_right
from collections import deque
inf = float('inf')
mod = 1000000007

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())
number = int(input())
n = 0
ref = set([])

def f(n):
	n += 1
	while n % 10 == 0:
		n = n // 10
	return n
while True:
	if number in ref:
		break
	n += 1
	ref.add(number)
	number = f(number)
print(n)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
if n < 10:
	print(9)
	exit(0)
ans = 10
n += 1
while n > 9:
	while n % 10 != 0:
		ans += 1
		n += 1
	n //= 10
print(ans)


def fx(num):
	res = num + 1
	while res % 10 == 0:
		res /= 10
	return res

def main():
	n = int(input())
	reachable = {n}
	repeat = False
	current = n
	while not repeat:
		temp = fx(current)
		if temp in reachable:
			repeat = True
		else:
			current = temp
			reachable.add(temp)
	print(len(reachable))
main()


n = int(input())
s = set([])
count = 0
start = 1
while not n in s or start:
	start = 0
	s.add(n)
	n += 1
	while n % 10 == 0:
		n //= 10
	count += 1
print(count)


def f(x):
	return int(str(x + 1).rstrip('0'))

def main():
	x = int(input())
	l = set()
	while x not in l:
		l.add(x)
		x = f(x)
	print(len(l))

def __starting_point():
	main()
__starting_point()


n = int(input())
a = []
c = 0
a.append(n)
f = 0
n += 1
while n not in a:
	if f == 1:
		a.append(n)
		n += 1
	f = 1
	c = 0
	while c == 0:
		x = n % 10
		if x != 0:
			c = 1
		else:
			c = 0
			n = n // 10
print(len(a))


x = int(input())
res = 0
xx = x
while x > 9:
	r = x % 10
	res += 10 - r
	x += 10 - r
	while x % 10 == 0:
		x //= 10
	if x < 10:
		break
res += 9
print(res)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
ins = RI()
reachable = set()
while ins not in reachable:
	reachable.add(ins)
	ins = int(str(ins + 1).strip('0'))
print(len(reachable))


import math
from collections import defaultdict, Counter, deque

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = list(input())
	i = len(n) - 1
	count = 0
	while i >= 0:
		if i == 0:
			count += 9
		else:
			count += 10 - int(n[i])
			j = i - 1
			while n[j] == 9:
				n[j] = str(0)
				j -= 1
			n[j] = str(int(n[j]) + 1)
		i -= 1
	print(count)
t = 1
for _ in range(t):
	main()


import sys
input = sys.stdin.readline

def reachable(n):
	xtra = 1 if n % 10 == 0 else 0
	seen = {n}
	n += 1
	seen.add(n)
	visited = [0] * 11
	while True:
		if n <= 10:
			visited[n] += 1
			if visited[n] == 2:
				break
		while n % 10 == 0:
			n //= 10
		seen.add(n)
		n += 1
		seen.add(n)
	return sum((1 for i in seen if i % 10 != 0)) + xtra
n = int(input())
print(reachable(n))


def solution(n, ans):
	if n < 10:
		return ans + 9
	m = 10 - n % 10
	ans = ans + m
	n = n + m
	while n % 10 == 0:
		n = n // 10
	return solution(n, ans)
n = int(input())
print(solution(n, 0))


def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
w = int(input())
q = []
while not w in q:
	if not w in q:
		q += [w]
	w = f(w)
print(len(q))


import math
from decimal import *
getcontext().prec = 30
n = int(input())
dict = {}
dict[n] = 1

def fn(y):
	y += 1
	while y % 10 == 0:
		y = y // 10
	return y
while 1:
	n = fn(n)
	if n in dict:
		break
	dict[n] = 1
print(len(dict))


my_number = int(input())
myset = set([])
myset.add(my_number)
iteration = 0

def mainFunction(number):
	number = number + 1
	if number % 10 == 0:
		while number % 10 == 0:
			number = int(number / 10)
		if number in myset:
			return
		mainFunction(number)
		myset.add(number)
	else:
		if number in myset:
			return
		myset.add(number)
		mainFunction(number)
mainFunction(my_number)
result = len(myset)
print(result)


n = int(input())
nList = [n]
count = 1
value = n
while True:
	value = value + 1
	while value % 10 == 0:
		value = value / 10
	if value in nList:
		break
	else:
		nList.append(value)
	count += 1
print(count)


n = int(input())
doneNums = []
while n not in doneNums:
	doneNums.append(n)
	n += 1
	while n % 10 == 0:
		n /= 10
print(len(doneNums))


n = int(input())
if n < 10:
	r = 0
else:
	r = 1
while True:
	n += 1
	while n % 10 == 0:
		n = n / 10
	if n < 10:
		r += 9
		break
	r += 1
print(r)


n = int(input())
ans = 0
stop = True
if n < 10:
	print(9)
else:
	while stop:
		ans += n // 10 * 10 + 10 - n
		n = n // 10 * 10 + 10
		while n % 10 == 0:
			n = n // 10
		if n < 10:
			ans += 9
			stop = False
	print(ans)


n = input()
tmp = (len(n) - 1) * 9
for i in range(1, len(n)):
	tmp = tmp - int(n[i])
if len(n) != 1:
	print(tmp + 10)
else:
	print(tmp + 9)


a = []

def fun(n):
	if n in a:
		return 0
	else:
		a.append(n)
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	return 1 + fun(n)
n = int(input())
print(fun(n))


n = int(input())
d = str(n)
l = len(d)
sums = 0
for i in range(1, l - 1):
	sums += 10 - int(d[i]) - 1
sums += 9
if l > 1:
	sums = sums + 10 - n % 10
print(sums)


hist = []
answer = 0

def reach(num):
	if num in hist:
		return 0
	global answer
	answer += 1
	hist.append(num)
	n = num + 1
	if n % 10 == 0:
		while n % 10 == 0:
			n = n // 10
		reach(n)
	else:
		reach(n)
nb = input()
nb = int(nb)
reach(nb)
print(answer)


n = int(input())
counter = 0
test = set([n])
while 1:
	n += 1
	while 1:
		if n % 10 == 0:
			n //= 10
		else:
			break
	if n in test:
		break
	test.add(n)
	counter += 1
print(counter + 1)


def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
saves = {}
inp = int(input())
saves[inp] = True
while True:
	inp = f(inp)
	if inp in saves:
		break
	saves[inp] = True
print(len(saves))


def mp():
	return map(int, input().split())

def f(x):
	x += 1
	while x % 10 == 0 and x != 0:
		x //= 10
	return x
n = int(input())
u = set()
while not n in u:
	u.add(n)
	n = f(n)
print(len(u))


__version__ = '0.1'
__date__ = '2019-04-26'
import sys

def f(n):
	ans = n + 1
	while ans % 10 == 0:
		ans = ans // 10
	return ans

def solve(n):
	next_n = f(n)
	reaches = [n]
	while next_n not in reaches:
		reaches.append(next_n)
		next_n = f(next_n)
	return len(reaches)

def main(argv=None):
	n = int(input())
	print(solve(n))
	return 0
STATUS = main()
sys.exit(STATUS)


s = int(input())
lst = []
count = 1
for i in range(100000):
	if str(s) + '1' not in lst:
		count += 1
		lst.append(str(s) + '1')
	s = int(s) + 1
	if str(s)[-1] == '0':
		while str(s)[-1] == '0':
			s = str(s)[:-1]
print(count - 1)


n = int(input())

def f(x):
	x += 1
	while x % 10 == 0 and x >= 10:
		x = int(x / 10)
	return x
res = set([n])
resc = 0
while f(n) not in res:
	n = f(n)
	res.add(n)
print(len(res))


def funcion(x):
	if x % 10 == 0:
		return funcion(int(x / 10))
	else:
		return x
x = int(input())
lista = [x]
while True:
	x += 1
	x = funcion(x)
	if x in lista:
		break
	else:
		lista.append(x)
print(len(lista))


x = int(input())
r = ''
s = 0
z = [x]
t = 0
while True:
	x = x + 1
	t = 0
	if x % 10 == 0:
		r = str(x)
		s = r.count('0')
		for i in range(len(r) - 1, -1, -1):
			if r[i] != '0':
				break
			else:
				t = t + 1
		x = int(x / 10 ** t)
	if x in z:
		break
	z.append(x)
print(len(z))


s = set()
s.update(range(1, 10))
n = int(input())
s.add(n)
while n != 1 and n != 0:
	n += 1
	while n % 10 == 0:
		n //= 10
	if not n in s:
		s.add(n)
print(len(s))


n = int(input())
a = set()
a.add(n)

def f(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	return n
while n:
	n = f(n)
	if n not in a:
		a.add(n)
	else:
		break
print(len(a))


from sys import stdin
sys_input = stdin.readline

def si():
	return sys_input().rstrip()

def ii():
	return int(si())

def sti():
	return si().split()

def iti():
	return map(int, sti())

def sli():
	return list(si())

def ili():
	return list(iti())

def main():
	n = N
	if n < 10:
		print(9)
		return
	cnt = 1
	while True:
		n += 1
		while n % 10 == 0:
			n //= 10
		if n < 10:
			cnt += 9
			break
		cnt += 1
	print(cnt)
	return
N = ii()
main()


def fn(n):
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n //= 10
	return n
n = int(input())
s = [n]
while True:
	n = fn(n)
	if n in s:
		break
	s.append(n)
print(len(set(s)))


n = input()
cn = 0
while len(n) > 1:
	if len(n) == len(str(int(n[::-1]))):
		cn += 10 * (int(int(n) / 10) + 1) - int(n)
	else:
		cn += 10 * (int(int(n) / 10) + 1) - int(n)
	n = str(int(str(10 * (int(int(n) / 10) + 1))[::-1]))[::-1]
if len(n) == 1:
	print(cn + 9)


n = int(input())
ans = 9
while n >= 10:
	last = 10 - n % 10
	ans += last
	n += last
	while n % 10 == 0:
		n //= 10
print(ans)


n = input()

def A(x):
	if len(x) == 1:
		return 9
	temp = (len(x) - 1) * 9
	total = 0
	for i in range(1, len(x)):
		total += int(x[i])
	return temp - total + 10
print(A(n))


def special(a):
	b = a + 1
	while b % 10 == 0:
		b /= 10
	return b
n = int(input())
reachable = [n]
while 1 == 1:
	n = special(n)
	if n in reachable:
		break
	else:
		reachable.append(int(n))
print(len(reachable))


n = int(input())
s = 0
if n < 10:
	print(9)
else:
	while n > 9:
		r = n % 10
		v = 10 - r
		s += v
		n = n + v
		while n % 10 == 0:
			n = n // 10
	print(s + 9)


def count(n):
	count = 0
	while n >= 10:
		count += 10 - n % 10
		n += 10 - n % 10
		n = n / 10
		while n % 10 == 0:
			n = n / 10
	return count + 9
n = int(input())
print(int(count(n)))


def function(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
x = int(input())
i = 9
while x >= 10:
	x = function(x)
	i += 1
print(i)


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
base = int(input())
compteur = 1
liste = [base]
while f(base) not in liste:
	liste.append(f(base))
	base = f(base)
	compteur += 1
print(compteur)


import sys
n = int(sys.stdin.readline().strip())
seen = set()

def f(x):
	x = x + 1
	while x % 10 == 0:
		x /= 10
	return int(x)
while n not in seen:
	seen.add(n)
	n = f(n)
print(len(seen))


x = int(input())
r = set()
n = -1
while n != len(r):
	n = len(r)
	r.add(x)
	x += 1
	while x % 10 == 0:
		x //= 10
print(len(r))


from sys import stdin
input = stdin.readline
n = int(input())
res = 0
while n >= 10:
	n += 1
	while n % 10 == 0:
		n //= 10
	res += 1
print(res + 9)


n = int(input())
res = [1, 2, 3, 4, 5, 6, 7, 8, 9, n]
while n >= 10:
	n += 1
	while n % 10 == 0:
		n /= 10
	res.append(n)
print(len(set(res)))


n = int(input())
ans = 0
while n != 1:
	if n > 9:
		n += 1
		ans += 1
		temp = str(n)
		while temp[-1] == '0':
			temp = temp[:len(temp) - 1]
		n = int(temp)
	else:
		break
print(ans + 9)


def f(k: int):
	if k in res_set:
		return
	res_set.add(k)
	new_k = k + 1
	while new_k % 10 == 0:
		new_k //= 10
	f(new_k)
res_set = set()
n = int(input())
f(n)
print(len(res_set))


n = int(input())
count = 1

def f(n, count):
	if n < 10:
		count = count + 8
		return count
	elif (n + 1) % 10 == 0:
		n = n + 1
		while n % 10 == 0:
			n = int(n / 10)
		count = count + 1
		return f(n, count)
	else:
		n = n + 1
		count = count + 1
		return f(n, count)
x = f(n, 1)
print(x)


n = int(input())
b = []

def rec(n):
	ans = 0
	if n in b:
		return 0
	else:
		while n % 10 == 0:
			n = int(n / 10)
		ans += 1
		b.append(n)
		return ans + rec(n + 1)
if n < 10:
	print(9)
elif str(n)[0] == '9':
	print(rec(n + 1))
else:
	print(rec(n + 1) + 1)


import time
from sys import stdin, stdout, stderr

def readline(input_type=None):
	line_list = stdin.readline().strip().split()
	if input_type:
		return list(map(input_type, line_list))
	return line_list

def main_solve():
	n = readline(int)[0]
	cnt = 9
	if n < 10:
		return cnt
	while n >= 10:
		cnt += 1
		n += 1
		while n % 10 == 0:
			n = n // 10
	return cnt

def main():
	start = time.time()
	print(main_solve(), file=stdout)
	print('Time: {}s'.format(time.time() - start), file=stderr)
main()


n = int(input())
s = str(n)
x = n
k = []
k.append(n)
if n == 1:
	print(9)
else:
	while int(s) != 0:
		s = str(int(s) + 1)
		while s[-1] == '0':
			s = s[:-1]
		else:
			s = s
			if int(s) in k:
				break
			else:
				k.append(int(s))
	print(len(k))


n = input()
li = [1, 2, 3, 4, 5, 6, 7, 8, 9]
if len(n) != 1:
	li.append(n)
while len(n) != 1:
	for i in range(int(n[-1]) + 1, 10):
		li.append(n[:-1] + str(i))
	n = n[:-1]
print(len(li))


n = int(input())

def f(k):
	res = k + 1
	while res % 10 == 0:
		res /= 10
	return res
cnt = 0
cur = n
reachables = set()
while cur not in reachables:
	reachables.add(cur)
	cur = f(cur)
	cnt += 1
print(cnt)


def f(n):
	n = n + 1
	while str(n)[-1] == '0':
		n //= 10
	return n
d = {}
n = int(input())
nxt = int(n)
d[nxt] = 1
while True:
	nxt = f(nxt)
	if nxt in d:
		break
	else:
		d[nxt] = 1
print(len(d))


def f(n):
	x = str(n + 1)
	while x[-1] == '0':
		x = x[:-1]
	return int(x)
a = int(input())
l = []
while a not in l:
	l.append(a)
	a = f(a)
print(len(l))


st = input()
ans = [st]
while True:
	st = str(int(st) + 1)
	for i in reversed(range(len(st))):
		if st[i] != '0':
			st = ''.join(st[:i + 1])
			break
	if st in ans:
		break
	ans.append(st)
print(len(ans))


import sys
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
n = ri()

def f(x):
	y = x + 1
	while y % 10 == 0:
		y = y // 10
	return y
ans = 0
while n >= 10:
	n = f(n)
	ans += 1
ans += 9
print(ans)


n = input()
count = 0
if len(n) >= 2:
	for i in range(1, len(n)):
		count += 10 - int(n[i]) - 1
	count += 10
	print(count)
else:
	print(9)


s = list(map(int, input()))[1:]
if not s:
	print(9)
else:
	print(1 + 9 + sum(map(lambda z: 9 - z, s)))


n = int(input())
d1 = {}
while n not in range(1, 10):
	if n not in d1:
		d1[n] = 1
	else:
		n += 1
		while n % 10 == 0:
			n = n // 10
print(len(d1) + 9)


x = int(input())
count = 9
while x >= 10:
	count += 1
	x += 1
	while x % 10 == 0:
		x //= 10
print(count)


n = int(input())
l = list(str(n))
l1 = len(l)
c = 0
p = 0
for i in range(l1 - 1, 0, -1):
	c = c + 10 - int(l[i])
if l1 > 2:
	p = l1 - 2
print(c + 9 - p)


def solve(n):
	n += 1
	return int(str(int(str(n)[::-1]))[::-1])
n = int(input())
cont = 0
ans = []
while len(str(n)) > 1:
	ans.append(n)
	n = solve(n)
print(len(ans) + 9)


def f(x):
	return int(str(x + 1).strip('0'))

def solve(n):
	arr = [n]
	while n >= 10:
		arr.append(f(n))
		n = f(n)
	m = f(n)
	arr.append(m)
	while m != n:
		m = f(m)
		arr.append(m)
	return len(set(arr))
print(solve(int(input())))


import sys
import math
import re
import io

def get_next(n):
	n = n + 1
	while n > 0 and n % 10 == 0:
		n //= 10
	return n

def solve(n):
	my_set = set()
	while not n in my_set:
		my_set.add(n)
		n = get_next(n)
	return len(my_set)

def main():
	n = int(input())
	ans = solve(n)
	print(ans)
main()


n = int(input())
x = set()
count = 0
while n not in x:
	x.add(n)
	n = n + 1
	count += 1
	while n % 10 == 0:
		n = n // 10
print(count)


n = int(input())
cnt = 9
while n // 10 != 0:
	cnt += 10 - n % 10
	n += 10 - n % 10
	while n % 10 == 0:
		n = n // 10
print(cnt)


def func(x):
	x += 1
	while x % 10 == 0:
		x = x / 10
	return int(x)
lis = []
x = int(input())
lis.append(x)
a = func(x)
while a not in lis:
	lis.append(a)
	a = func(a)
print(len(lis))


n = int(input())
if n == 0:
	print('1')
	quit()
if n // 10 == 0:
	print('9')
	quit()
n += 1
sum = 10
while n // 10 != 0:
	if n % 10 == 0:
		n = n // 10
	else:
		sum += 1
		n += 1
print(sum)


n = int(input())

def f(n):
	if (n + 1) % 10 == 0:
		n += 1
		while n % 10 == 0:
			n = n // 10
		return n
	return n + 1
ans = set()
ans.add(n)
curr = f(n)
while curr != 1:
	ans.add(curr)
	curr = f(curr)
for i in range(1, 10):
	if i not in ans:
		ans.add(i)
print(len(ans))


from sys import setcheckinterval, setrecursionlimit, stdout, stdin
setcheckinterval(1000)
setrecursionlimit(10 ** 6)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
n = iin()
sol = set()
while n not in sol:
	sol.add(n)
	n += 1
	while n % 10 == 0:
		n //= 10
print(len(sol))


number = int(input())
set1 = dict()
set1[number] = 1
while True:
	number = number + 1
	number = int(str(number).strip('0'))
	try:
		if set1[number] == 1:
			break
	except:
		set1[number] = 1
print(len(set1))


n = int(input())
count = 1
a = n
d = []
d.append(n)
while True:
	es = ''
	n += 1
	a = n
	a = str(a)
	a = a.rstrip('0')
	a = int(a)
	n = a
	if n in d:
		break
	else:
		d.append(n)
	count += 1
print(count)


def f(num):
	num += 1
	while num % 10 == 0:
		num /= 10
	return num
num = int(input())
seen = [num]
while True:
	num = f(num)
	if num in seen:
		break
	seen.append(num)
print(len(seen))


n = int(input())
mass = []
sumi = 1
while n > 0:
	if n not in mass:
		mass.append(n)
		n += 1
		while n % 10 == 0:
			n //= 10
	else:
		print(len(mass))
		break


def main():
	n = int(input())
	ans = 0
	ncopy = n
	while n != 0:
		k = n % 10
		n = n // 10
		if n == 0:
			ans += 9
		elif ncopy // 10 == n:
			ans += 10 - k
		elif k + 1 < 10:
			ans += 10 - k - 1
	print(ans)
main()


f = 0
n = int(input())
cn = n
se = set()
s = str(n)
if s[-1] == '0':
	f = 1
	n += 1
	se.add(n)
else:
	se.add(n)
while 1:
	s = str(n)
	l = len(s)
	if s[-1] == '0':
		while s[-1] == '0':
			l -= 1
			s = s[:l]
		n = int(s)
		if n in se:
			break
	else:
		n += 1
		s = str(n)
		l = len(s)
		if s[-1] == '0':
			while s[-1] == '0':
				l -= 1
				s = s[:l]
			n = int(s)
		if n in se:
			break
	se.add(n)
if f:
	se.add(cn)
print(len(se))


num = int(input())
counter = 0
while num > 9:
	counter += 1
	num += 1
	while num % 10 == 0:
		num //= 10
print(counter + 9)


import time
n = int(input())
a = set({n})
while True:
	x = n + 1
	x = str(x)
	x = x.rstrip('0')
	n = int(x)
	if n in a:
		break
	a.add(n)
print(len(a))


x = list(input())
x = list(map(int, x))
res = 0
for i in range(len(x)):
	if i == 0:
		res += 9
	elif i == len(x) - 1:
		res += 10 - x[i]
	else:
		res += 9 - x[i]
print(res)


def function(a):
	a1 = a
	a1 += 1
	while a1 % 10 == 0:
		a1 //= 10
	return a1
n = int(input())
array = [n]
while True:
	n = function(n)
	if not array.count(n):
		array.append(n)
	else:
		break
print(len(array))


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs(src):
	from collections import deque
	que = deque([src])
	dist = set()
	dist.add(src)
	while que:
		u = que.popleft()
		v = u + 1
		while v % 10 == 0:
			v //= 10
		if v in dist:
			continue
		dist.add(v)
		que.append(v)
	return dist
N = INT()
res = bfs(N)
ans = len(res)
print(ans)


n = int(input())
a = [n]
while 1:
	n += 1
	while n % 10 == 0:
		n = n // 10
	if n in a:
		break
	a.append(n)
print(len(a))


def f(n):
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	return n
num = int(input())
if num < 10:
	print(9)
	exit(0)
a = set()
result = 0
while not num in a:
	a.add(num)
	num = f(num)
print(len(a))


n = int(input())

def f(x):
	s = str(x + 1)
	while len(s) > 1:
		if len(s) > 3:
			if s[len(s) - 1] == '0':
				s = s[:len(s) - 1]
			else:
				break
		elif len(s) == 3:
			if s[2] == '0':
				s = s[0] + s[1]
			else:
				break
		elif len(s) == 2:
			if s[1] == '0':
				s = s[0]
				break
			else:
				break
	return int(s)
memo = []
memo.append(n)
while 1:
	n = f(n)
	if n in memo:
		break
	else:
		memo.append(n)
print(len(memo))


import sys
n = int(input())
s = set()
s.add(n)
for i in range(50000):
	n += 1
	while n % 10 == 0 and n != 0:
		n /= 10
	s.add(n)
print(len(s))


def find(num):
	num += 1
	while num % 10 == 0:
		num = num // 10
	return num
n = int(input())
dic = {n: 1}
n = find(n)
while n not in dic:
	dic[n] = 1
	n = find(n)
print(len(dic))


import sys
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
d = defaultdict(lambda : defaultdict(int))
n = int(input())
count = 1
d[n] = 1
while 1:
	n += 1
	while 1:
		if list(str(n))[-1] == '0':
			n //= 10
		else:
			break
	if d[n] == 1:
		break
	else:
		d[n] = 1
		count += 1
print(count)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()

	def f(i):
		i += 1
		while i % 10 == 0:
			i //= 10
		return i
	s = set()
	while n not in s:
		s.add(n)
		n = f(n)
	return len(s)
print(main())


first = int(input())
num = [first]
visit1 = 0
while True:
	if first == 1:
		visit1 += 1
	if visit1 == 2:
		break
	first = first + 1
	while first % 10 == 0:
		first = first // 10
	if first not in num:
		num.append(first)
print(len(num))


from sys import stdin, stdout
import bisect
import math
from collections import deque
mod = 10 ** 9 + 7

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def DFS(dictionary, vertex, visited):
	visited[vertex] = True
	stack = [vertex]
	print(vertex)
	while stack:
		a = stack.pop()
		for i in dictionary[a]:
			if not visited[i]:
				print(i)
				visited[i] = True
				stack.append(i)

def BFS(dictionary, vertex, visited):
	visited[vertex] = True
	q = deque()
	q.append(vertex)
	while q:
		a = q.popleft()
		for i in dictionary[a]:
			if not visited[i]:
				visited[i] = True
				q.append(i)
				print(i)

def soe(limit):
	l = [1] * (limit + 1)
	l[0] = 0
	l[1] = 0
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def gcd(a, b):
	while b:
		a = a % b
		(b, a) = (a, b)
	return a

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
		a *= a
		n = n >> 1
	return r

def solve():
	n = inp()
	c = 0
	i = 0
	while n >= 10:
		z = n % 10
		if z == 0:
			c += 10
			n += 10
		else:
			c += 10 - z
			n += 10 - z
		while n % 10 == 0:
			n //= 10
	c += 9
	pr(c)
for _ in range(1):
	solve()


n = int(input())
l = []
l.append(n)
check = 0
while True:
	t = n + 1
	while t % 10 == 0:
		t = int(t / 10)
	for i in l:
		if i == t:
			check = 1
			break
	if check == 1:
		break
	l.append(t)
	n = t
print(len(l))


s = input()
ans = 0
i = len(s) - 1
n = int(s)
n1 = s
n1 += '0'
n1 = int(n1)
while n > 0:
	s = str(n)
	ans += 10 - int(s[len(s) - 1])
	s1 = str(n1)
	if len(s1) == len(s):
		ans -= min(10 - int(s[-1]), 10 - int(s1[-1]))
	n1 = n
	n = n // 10
	n = n + 1
	s = str(n)
	se = ''
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '0':
			continue
		else:
			break
	s = s[:i + 1]
	n = int(s)
	if n == n1:
		break
print(ans)


n = int(input(''))
add = 0
while n > 9:
	n = n + 1
	add = add + 1
	if n % 10 == 0:
		while n % 10 == 0:
			n = n / 10
	else:
		continue
print(add + 9)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def solve(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n

def main():
	try:
		temp = set()
		n = I()
		while n not in temp:
			temp.add(n)
			n = solve(n)
		print(len(temp))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


def f(n):
	if n % 10 != 9:
		return n + 1
	else:
		n += 1
		while n % 10 == 0:
			n /= 10
		return n
n = int(input())
temp_n = n
lm = 0
while temp_n > 9:
	temp_n = f(temp_n)
	lm += 1
print(lm + 9)


result = input()
ans = 9
cnt = len(result)
flag = 0
while cnt != 1:
	h = ord(result[cnt - 1]) - 48
	if flag == 0:
		ans += 10 - h
		flag = 1
		cnt = cnt - 1
		continue
	if flag == 1:
		h += 1
		if h == 10:
			cnt = cnt - 1
			continue
		else:
			ans += 10 - h
			cnt = cnt - 1
			continue
print(ans)


from math import *
n = int(input())
l = []
while n > 1:
	l.append(n)
	n += 1
	while n % 10 == 0:
		n //= 10
for i in range(1, 10):
	l.append(i)
print(len(set(l)))


n = int(input())
turn = 0
k = 0
while n // 10 != 0:
	if turn == 0:
		n += 1
		if n % 10 != 0:
			k += 1
		turn = 1
	else:
		if n % 10 == 0:
			while n % 10 == 0:
				n //= 10
			k += 1
		turn = 0
print(k + 9)


def function(x):
	list = []
	y = 0
	x1 = x + 1
	while True:
		while x1 % 10 == 0:
			x1 = x1 // 10
		y += 1
		list.append(x1)
		if len(list) != len(set(list)):
			list.append(x)
			break
		x1 += 1
	return print(len(set(list)))
x = int(input())
function(x)


n = int(input())
summ = 1
S = set()

def get(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
c = n
S.add(c)
while get(c) not in S:
	c = get(c)
	S.add(c)
	summ += 1
print(summ)


n = int(input())
sum1 = 0
c = 0
if n == 1:
	print('9')
else:
	while n > 9:
		grNum = n // 10 + 1
		grNum = grNum * 10
		sum1 += grNum - n
		n = int(str(grNum).strip('0'))
	print(sum1 + 9)


def f(x):
	x += 1
	if x % 10 != 0:
		return x
	for i in range(len(str(x)), 0, -1):
		if x % 10 ** i == 0:
			return int(x / 10 ** i)
s = set()
n = int(input())
while not n in s:
	s.add(n)
	n = f(n)
print(len(s))


n = input()
keta = len(n)
n = int(n)
count = 0
if n % 10 == 0:
	count += 1
	n += 1
for _ in range(keta - 1):
	t = 10 - n % 10
	if t != 10:
		count += t
		n += t
	n = n // 10
count += 9
print(count)


x = int(input())
c = 0
if x == 1:
	print(9)
else:
	a = []
	while x not in a:
		a.append(x)
		x += 1
		x = int(str(x).strip('0'))
		c += 1
	print(c)


import sys, collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
from math import sqrt
n = int(input())
st = {}
while n not in st:
	st[n] = True
	n += 1
	while not n % 10:
		n //= 10
print(len(st))


n = int(input())
a = 0
s = 0
flag = 0
while int(n / 10) != 0:
	a = n % 10
	flag = 1
	s += 9 - a
	n = int(n / 10)
if flag == 1:
	print(s + 10)
else:
	print(s + 9)


x = int(input())

def f(x):
	x += 1
	if str(x)[-1] == '0':
		return int(str(x).rstrip('0'))
	else:
		return x
nums = set([x])
while True:
	x = f(x)
	if x in nums:
		break
	else:
		nums.add(x)
print(len(nums))


import sys
input = sys.stdin.readline
import math
n = int(input())
l = [i + 1 for i in range(9)]

def f(n):
	count = 0
	while n > 9:
		n += 1
		while n % 10 == 0:
			n = n // 10
		count += 1
	count += 9
	print(count)
f(n)


import math
n = int(input().lstrip())
res = set([i for i in range(1, 10)])
while n >= 10:
	res.add(n)
	n += 1
	while n % 10 != 0:
		res.add(n)
		n += 1
	while n % 10 == 0:
		n //= 10
print(len(res))


n = int(input())

def f(x, set_numbers):
	while x not in set_numbers:
		set_numbers.add(x)
		x = x + 1
		while x % 10 == 0:
			x = x // 10
s = set()
f(n, s)
print(len(s))


n = int(input())
r = 1

def modify(n):
	m = n + 1
	if m % 10 == 0:
		while m % 10 == 0:
			m = int(m / 10)
	return m

def count(n, r):
	l = [n]
	while True:
		if modify(n) == 1:
			break
		else:
			n = modify(n)
			l.append(n)
	l = l + [1, 2, 3, 4, 5, 6, 7, 8, 9]
	l = list(set(l))
	return len(l)
print(count(n, r))


def f(n, res):
	n += 1
	while n % 10 == 0:
		n = n / 10
	if n in res:
		return []
	res.append(n)
	f1 = f(n, res)
	return res + list(set(f1) - set(res))
n = int(input())
print(len(f(n, [n])))


a = int(input())
c = 0
myList = []
if a == 1:
	a = 2
while 1:
	if a in myList:
		print(c)
		break
	else:
		myList.append(a)
		a += 1
		if a % 10 == 0:
			x = 10
			while 1:
				if a % x == 0:
					x *= 10
				else:
					a //= x // 10
					break
		c += 1


seed = int(input())
nums = set()
one = False
while True:
	if seed == 1 and 1 in nums:
		break
	nums.add(seed)
	seed += 1
	while seed % 10 == 0:
		seed /= 10
	if seed == 1:
		one = True
print(len(nums))


x = int(input())
t = x
s = 0
if x < 10:
	print('9')
else:
	for i in range(0, 10000):
		x = x + 1
		for j in range(0, 10000):
			if x % 10 == 0:
				x = x / 10
			else:
				s = s + 1
				break
		if x < 10:
			s = s + 9
			break
	print(s)


def func(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	return n
n = int(input())
ans = [n]
while True:
	new_n = func(n)
	if new_n in ans:
		break
	ans.append(new_n)
	n = new_n
print(len(ans))


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def __next__(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = self.next_line()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_line(self, _map=str):
		return list(map(_map, sys.stdin.readline().split()))

	def next_int(self):
		return int(next(self))

	def solve(self):
		n = self.next_int()
		rs = {}
		while n not in rs:
			rs[n] = n
			n += 1
			while n % 10 == 0:
				n /= 10
		print(len(rs))

def __starting_point():
	Main().solve()
__starting_point()


def f(x):
	x += 1
	x = str(x)
	while x[-1] == '0':
		x = x[:-1]
	return int(x)

def main(n):
	a = set()
	t = n
	while t not in a:
		a.add(t)
		t = f(t)
	return len(a)
n = int(input())
print(main(n))


while True:
	try:
		n = int(input())
		r = set([])
		while n not in r:
			r.add(n)
			n += 1
			while n % 10 == 0:
				n //= 10
		print(len(r))
	except:
		break


n = int(input())
mini = n
count = 1
if n % 10 == 0:
	n += 1
	count += 1
rem = 10 - n % 10
count += rem - 1
n += rem
while True:
	if n % 10 == 0:
		n //= 10
	else:
		if mini != n:
			count += 1
		rem = 10 - n % 10
		if abs(mini - n) <= 1:
			break
		if n + rem >= mini:
			count += mini - n - 1
		else:
			count += rem - 1
		mini = min(n, mini)
		n += rem
print(count)


n = int(input())

def del10(x):
	if x % 10 == 0:
		x = x // 10
		x = del10(x)
	return x

def f(x):
	x += 1
	x = del10(x)
	return x
a = []
while a.count(f(n)) < 1:
	a.append(n)
	n = f(n)
print(len(a) + 1)


mod = 10 ** 9 + 7
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = si()
sm = sum((9 - int(i) for i in n))
print(sm + int(n[0]) + 1 if len(n) > 1 else sm + int(n[0]))


from collections import defaultdict
n = int(input())
done = defaultdict(lambda : False)
ans = 0
while done[n] == False:
	done[n] = True
	n += 1
	while n % 10 == 0:
		n = n // 10
	ans += 1
print(ans)


n = int(input())
c = 0
arr = [n]
while arr.count(n) <= 1:
	a = 0
	n += 1
	for i in list(reversed(list(str(n)))):
		if i == '0':
			a += 1
		else:
			break
	n = n // 10 ** a
	arr.append(n)
	c += 1
print(c)


from sys import stdin, stdout, maxsize
import math
from copy import deepcopy
from collections import defaultdict
import heapq

def brute(n, count, mydict):
	if n == 0 or n in mydict:
		return
	elif n > 0:
		count[0] += 1
		mydict[n] = True
		n += 1
		while n % 10 == 0:
			n //= 10
		brute(n, count, mydict)
n = int(stdin.readline().strip())
count = [0]
mydict = dict()
brute(n, count, mydict)
print(count[0])


def f(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	return n
x = int(input())
l = [x]
while 1:
	x = f(x)
	if x in l:
		break
	l.append(x)
print(len(l))


s = input()
total = int(s[0])
for c in s:
	total += ord('9') - ord(c)
if len(s) != 1:
	total += 1
print(total)


def trail(n):
	k = str(n)
	k = k.strip('0')
	n = int(k)
	return n
n = int(input())
l = [n]
j = True
while j:
	n += 1
	n = trail(n)
	if l.count(n) == 0:
		l.append(n)
	elif l.count(n) == 1:
		j = False
	if not j:
		break
print(len(l))


n = input()
q = []
while len(n) > 1:
	q.append(n)
	n = str(int(n) + 1)
	while n[-1] == '0':
		n = n[:-1]
w = set(q) | {'1', '2', '3', '4', '5', '6', '7', '8', '9'}
print(len(w))


n = int(input())
res = 0
while n >= 10:
	res += 1
	n += 1
	while n % 10 == 0:
		n //= 10
print(res + 9)


def c(n):
	n += 1
	while 1:
		if n % 10 == 0:
			n = n / 10
		else:
			break
	return int(n)
n = int(input())
l = [n]
while 1:
	tmp = c(n)
	if tmp in l:
		break
	elif tmp not in l:
		l.append(tmp)
		n = tmp
print(len(l))


def Next(num):
	num = int(num)
	result = str(num + 1)
	while result[len(result) - 1] == '0':
		result = result[:-1]
	return result
num = input()
count = 1
while True:
	if len(num) == 1:
		if num == '0':
			count = 10
			break
		else:
			count = 9
			break
	else:
		count += 1
		num = Next(num)
		if len(num) == 1:
			count += 8
			break
print(count)


def f(x):
	l = x + 1
	while l % 10 == 0:
		l /= 10
	return l
x = int(input())
z = [x]
while 1:
	j = f(x)
	if j not in z:
		z.append(j)
		x = j
	else:
		break
print(len(z))


n = input()
n = int(n)
list = []
c = 0
x = n
while not x in list:
	list.append(x)
	c += 1
	x += 1
	while x % 10 == 0:
		x = str(x)
		x = x[:-1]
		x = int(x)
print(c)


def reachable(n):
	if n < 10:
		return 9
	else:
		temp = 10 - n % 10
		n += temp
		while n % 10 == 0:
			n = int(n / 10)
		return reachable(n) + temp
n = int(input())
print(reachable(n))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
A = []
x = int(input())
while x not in A:
	A.append(x)
	x = f(x)
print(len(A))


n = int(input())
a = []
while n not in a:
	a.append(n)
	n += 1
	while n % 10 is 0:
		n //= 10
print(len(a))


number = input()
length = len(number)
x = length - 1
sum = 0
b = int(number[x])
a = int(number[x - 1])
x -= 2
sum = 10 - b
will_loop = x > 0 or len(number) == 3
if len(number) == 2:
	sum = sum + 9
elif len(number) == 1:
	if int(number) == 0:
		sum = 10
	else:
		sum = 9
while x > 0:
	b = a
	a = int(number[x])
	sum = sum + 9 - b
	x -= 1
if will_loop:
	sum = sum + 9 + 9 - a
print(sum)


n = int(input())
s = {n}

def f(x):
	x = x + 1
	while x % 10 == 0:
		x = x // 10
	return x
r = n
while True:
	r = f(r)
	if r not in s:
		s.add(r)
	else:
		break
print(len(s))


def solve():
	n = int(input())
	query = []
	query.append(n)
	while query.count(1) <= 2:
		n += 1
		while n % 10 == 0:
			n = n // 10
		query.append(n)
	print(len(list(set(query))))
solve()


def found(x, a):
	for i in a:
		if i == x:
			return True
	return False
n = int(input())
mas = []
while not found(n, mas):
	mas.append(n)
	n += 1
	while n % 10 == 0:
		n //= 10
print(len(mas))


n = int(input())
Y = {n}
while True:
	n += 1
	while n % 10 == 0:
		n //= 10
	if n in Y:
		print(len(Y))
		break
	Y.add(n)


def remove_zeros(n):
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
visited = set()
while n not in visited:
	visited.add(n)
	n = remove_zeros(n + 1)
print(len(visited))


num = int(input())
n = set()
n.add(num)

def f(x):
	global num
	foo = x + 1
	while foo % 10 == 0:
		foo = int(str(foo)[:-1])
	n.add(foo)
	num = foo
for _ in range(10000):
	f(num)
print(len(n))


n = int(input())
count = 0
bo = True
iden = 0
while True:
	if bo and n < 10:
		iden = n
		count += 1
		bo = False
	elif n == iden:
		break
	else:
		count += 1
	n += 1
	while n % 10 == 0:
		n //= 10
print(count)


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
k = 9
x = int(input())
while x > 9:
	k += 1
	x = f(x)
print(k)


n = int(input())
s = str(n)
count = 0
if len(s) == 1:
	print(9)
else:
	for i in range(len(s)):
		if i == 0:
			count += 9
		else:
			count += 9 - int(s[i])
	print(count + 1)


import math

def main():

	def f(x):
		x += 1
		while x > 0 and x % 10 == 0:
			x //= 10
		return x
	n = int(input())
	res = 1
	all = set()
	all.add(n)
	while True:
		n = f(n)
		if n in all:
			break
		res += 1
		all.add(n)
	print(res)
main()


def main():
	n = int(input())
	co = 0
	d = dict()
	while n:
		try:
			d[n]
			break
		except KeyError:
			d[n] = 1
		co += 1
		n += 1
		while n % 10 == 0:
			n //= 10
	print(co)
main()


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	n = inin()
	ans = 0
	d = {}
	while n > 0:
		if n not in d:
			d[n] = 1
		else:
			break
		n += 1
		while n % 10 == 0:
			n = n // 10
		ans += 1
	print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


n = int(input())
k = 100000

def rem(l):
	l = list(l)
	l.reverse()
	for i in range(len(l)):
		if l[i] != '0':
			o = i
			break
	l = l[o:]
	l.reverse()
	return str(''.join(l))
c = [n]
for i in range(k):
	n += 1
	n = int(rem(str(n)))
	c.append(n)
print(len(list(set(c))))


def f(x):
	r = str(x + 1)
	for i in range(len(r)):
		if r[-(i + 1)] != '0':
			break
	return int(r[:len(r) - i])
n = int(input())
s = {n}
while f(n) not in s:
	s.add(f(n))
	n = f(n)
print(len(s))


res = 0
temp = []
n = int(input())

def getnumber(n):
	return int(str(n)[0])
a = getnumber(n)

def process(n):
	global res
	res = res + 1
	n = n + 1
	if n % 10 == 0:
		while True:
			if n % 10 != 0:
				break
			else:
				n = n // 10
	return n

def process1(n):
	global a
	if n != a:
		process1(process(n))
if a == n:
	print(9)
else:
	process1(n)
	print(res + 1)


def fun(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
(s, n) = (1, int(input()))
if n < 10:
	s = 0
a = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
while True:
	n = fun(n)
	if n < 10:
		if a[n] == 0:
			a[n] += 1
		else:
			break
	s += 1
print(s)


n = int(input())
r = 0
a = set()
while n not in a:
	a |= {n}
	n += 1
	while n % 10 == 0:
		n //= 10
print(len(a))


n = int(input())
appeared = set()
while n >= 10:
	appeared.add(n)
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n //= 10
print(len(appeared) + 9)


import sys

def main():
	num = int(input())
	seen = set()
	while num:
		if num in seen:
			break
		seen.add(num)
		num += 1
		while num % 10 == 0:
			num //= 10
	print(len(seen))

def __starting_point():
	main()
__starting_point()


n = int(input().strip())
d = {}
d[n] = 1
cnt = 1
while True:
	n += 1
	while n % 10 == 0:
		n = n // 10
	if n not in d:
		d[n] = 1
		cnt += 1
	else:
		break
print(cnt)


s = input()
an = 0
if s[-1] == '0':
	an += 1
	s = s[:-1] + '1'
while len(s) > 1:
	a = 10 - int(s[-1])
	an += a
	s = str(int(s) + a)
	while s[-1] == '0':
		s = s[:-1]
an += 9
print(an)


n = int(input())
tot = 0
count = 0
while n // 10 != 0:
	rem = n % 10
	tot += 9 - rem
	n = n // 10
	count += 1
if count == 0:
	print(9)
else:
	print(9 + tot + 1)


def solution1157a():
	x = int(input())
	if x == 0:
		numbers = 10
	elif x < 10:
		numbers = 9
	else:
		numbers = 10
		while x >= 10:
			n = x % 10
			if n != 9:
				numbers += 9 - n
			x //= 10
	print(numbers)
solution1157a()


def f(n):
	t = str(n + 1)
	while t[-1] == '0':
		t = t[:len(t) - 1]
	return int(t)
n = int(input())
ans = [n]
a = f(n)
s = set()
s.add(n)
while a not in s:
	s.add(a)
	a = f(a)
print(len(s))


for _ in range(1):
	n = int(input())
	ct = 0
	while n // 10 != 0:
		rem = n % 10
		ct += 9 - rem + 1
		n = n // 10
		n += 1
		while n % 10 == 0:
			n = n // 10
	ct += 9
	print(ct)


c = []

def f(x):
	c.append(x)
	r = x + 1
	while r % 10 == 0:
		r //= 10
	if not r in c:
		f(r)
f(int(input()))
print(len(c))


n = int(input())
t = []
while True:
	if n not in t:
		t.append(n)
		n += 1
	else:
		break
	while n % 10 == 0:
		n //= 10
print(len(t))


n = int(input())

def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
val = {n}
flag = True
while flag:
	n = f(n)
	if n in val:
		flag = False
	val.add(n)
print(len(val))


n = int(input())
deff = []
a = list(str(n))
counter = 0
deff.append(n)
n += 1
while True:
	a = list(str(n))
	if a[-1] == '0':
		del a[-1]
		n = int(''.join(a))
	elif n in deff:
		break
	else:
		deff.append(n)
		n += 1
print(len(deff))


def line():
	return map(int, input().split())
n = int(input())
c = set()
while not n in c:
	c.add(n)
	n += 1
	while n % 10 == 0:
		n //= 10
print(len(c))


z = int(input())
count = 1
l = [z]
while True:
	t = l[-1] + 1
	if not t % 10:
		while True:
			if t % 10:
				break
			t = t // 10
	if t in l:
		break
	else:
		l.append(t)
print(len(l))


a = (input() + '0')[1:]
print(sum(map(int, str(int('9' * len(a)) - int(a)))) + (len(a) > 1))


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
a = []
while n:
	q = n % 10
	for i in range(n, n + (10 - q)):
		a.append(i)
	if n < 10:
		for i in range(1, n):
			a.append(i)
		break
	n //= 10
	n += 1
	while n % 10 == 0:
		n //= 10
a = set(a)
print(len(a))


def f(x):
	if x < 10:
		return 9
	cnt = 10 - x % 10
	x = cnt + x
	while x % 10 == 0:
		x = int(x / 10)
	return cnt + f(x)

def main():
	n = int(input())
	print(f(n))
main()


def f(x):
	return 1 + x
n = int(input())
v = [n]
while True:
	x = f(n)
	x = int(str(x)[::-1])
	x = int(str(x)[::-1])
	if x not in v:
		v.append(x)
	elif x in v:
		break
	n = x
print(len(v))


def func(x):
	x = x + 1
	while x % 10 == 0:
		x = x // 10
	return x
x = int(input())
if x < 10:
	print('9')
else:
	ans = []
	while True:
		x = func(x)
		if x not in ans:
			ans.append(x)
		else:
			break
	print(len(ans) + 1)


def A():

	def f(x):
		x += 1
		while x % 10 == 0:
			x //= 10
		return x
	n = int(input())
	res_list = []
	copy_n = n
	while copy_n not in res_list:
		res_list.append(copy_n)
		copy_n = f(copy_n)
	print(len(res_list))
A()


n = int(input())

def f(x: int):
	x = x + 1
	x = str(x)
	while x[-1] == '0':
		x = x[:-1]
	return int(x)
reachable = [n]
while f(n) not in reachable:
	n = f(n)
	reachable.append(n)
print(len(reachable))


def numbers(n):
	mylist.append(n)
	n = n + 1
	for i in range(1, len(str(n))):
		if n % 10 == 0:
			n = n / 10
			n = int(n)
	if n in mylist:
		return len(mylist)
	return numbers(n)
mylist = []
enter = input()
print(numbers(int(enter)))


def f(n):
	n += 1
	s = str(n)
	l = len(s)
	for i in range(l):
		if s[l - i - 1] != '0':
			return int(s[:l - i])
n = int(input())
s = set()
s.add(n)
for i in range(1000):
	n = f(n)
	s.add(n)
print(len(s))


def f(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
n = int(input())
s = {}
k = f(n)
s = {n, k}
while k != 1:
	k = f(k)
	s.add(k)
s = s.union({1, 2, 3, 4, 5, 6, 7, 8, 9})
print(len(s))


def solve(n):
	ans = 9
	while n > 9:
		n += 1
		ans += 1
		d = n % 10
		while d == 0:
			n //= 10
			d = n % 10
	return ans
n = int(input())
print(solve(n))


num = int(input())

def short(x):
	unique_numbers = {x}
	while True:
		x = x + 1
		while x % 10 == 0 and x != 0:
			x = x / 10
		if x not in unique_numbers:
			unique_numbers.add(x)
		else:
			break
	return len(unique_numbers)
print(short(num))


n = int(input())
ans = 9
while n not in list(range(1, 10)):
	ans += 10 - n % 10
	n //= 10
	while n % 10 + 1 == 10:
		n //= 10
	n += 1
print(ans)


n = int(input())
st = {}
while not n in st:
	st[n] = True
	n += 1
	while n % 10 == 0:
		n /= 10
print(len(st))


def f(n):
	return 9 + sum((9 - int(d) for d in n[1:])) + (len(n) > 1)
n = input()
print(f(n))


def change(n):
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
f = dict()
f[n] = 1
while 1:
	n = change(n + 1)
	if f.get(n) != None:
		break
	else:
		f[n] = 1
print(len(f))


n = int(input())
s = []
c = 0
while True:
	s.append(n)
	n += 1
	while n % 10 == 0:
		n = n // 10
	c += 1
	if c > 10000:
		break
print(len(set(s)))


ans = 0
used_numbers = list()

def recurs(number):
	global used_numbers
	global ans
	number += 1
	if used_numbers.count(number) != 0:
		print(ans)
		return
	else:
		used_numbers.append(number)
		while number % 10 == 0:
			number = number // 10
		ans += 1
		recurs(number)
n = int(input())
recurs(n)


def f(n):
	n = n + 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
lis = [n]
while 1:
	n = f(n)
	if n in lis:
		print(len(lis))
		break
	else:
		lis.append(n)


def cal(t):
	li = []
	li.append(t)
	t += 1
	while 1:
		if t % 10 == 0:
			t = t // 10
		elif t in li:
			break
		else:
			li.append(t)
			t += 1
	print(len(li))
t = int(input())
cal(t)


n = int(input())
l = [n]
while len(l) > 0:
	n = int(n) + 1
	n = str(n)
	if n.endswith('0'):
		while n[-1] == '0':
			n = n[0:len(n) - 1]
		if int(n) in l:
			break
		else:
			l.append(int(n))
	else:
		n = str(n)
		if n.endswith('0'):
			while n[-1] == '0':
				n = n[0:len(n) - 1]
			if int(n) in l:
				break
			else:
				l.append(int(n))
		elif int(n) in l:
			break
		else:
			l.append(int(n))
print(len(l))


def ans(n):
	if n % 10 == n:
		return 9
	else:
		cnt = 0
		while n % 10 != n:
			n += 1
			if n % 10 == 0:
				n = list(str(n))
				n = n[::-1]
				i = 0
				while n[i] == '0':
					i += 1
				n = n[i:]
				n = n[::-1]
				n = ''.join(n)
				n = int(n)
			cnt += 1
		return cnt + ans(n)
n = int(input())
print(ans(n))


m = int(input())
(count, flag) = (0, 0)
d = dict(zip(list(range(10)), list(range(10, 0, -1))))
if str(m)[-1:] == '0':
	flag = 1
if flag == 1:
	count += 10
	m += 10
while m >= 10:
	last = m % 10
	if last == 0:
		m = m // 10
	else:
		count += d[last]
		m += d[last]
else:
	count += d[m] + m - 1
	print(count)


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
z = n
q = {1, 2, 3, 4, 5, 6, 7, 8, 9, n}
while n not in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
	n = f(n)
	q.add(n)
print(len(q))


def f(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	return int(n)
n = int(input())
c = 1
s = 0
if n >= 1 and n <= 9:
	print(9)
else:
	while n != 1:
		n = f(n)
		if n < 10:
			break
		else:
			c += 1
	print(c + 9)


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

def main():

	def f(n):
		n += 1
		while n % 10 == 0:
			n //= 10
		return n
	num = int(input())
	nums = set()
	r = 0
	while True:
		if num in nums:
			break
		else:
			nums.add(num)
			r += 1
			num = f(num)
	print(r)
main()


n = input()
l = len(n)
total = 0
for i in range(l - 1, -1, -1):
	x = int(n[i])
	if i == l - 1 and i == 0:
		total += 9
	elif i == l - 1:
		total += 10 - x
	elif i == 0:
		total += 9
	else:
		total += 10 - (x + 1)
print(total)


from sys import stdout, stdin
import math
r = lambda : int(input())
ra = lambda : [*map(int, input().split())]
raw = lambda : [*stdin.readline()]
out = lambda a: stdout.write(''.join(a))

def f(A):
	a = A
	a += 1
	while a % 10 == 0:
		a //= 10
	return a

def g(A):
	if f(A) in a:
		return
	else:
		a.add(f(A))
		g(f(A))
n = r()
a = set()
g(n)
a.add(n)
print(len(a))


n = int(input())
c = 1
ls = []
s = str(n)
while True:
	ls.append(n)
	n = n + 1
	s = str(n)
	n = int(s.rstrip('0'))
	if n in ls:
		break
	c = c + 1
print(c)


N = int(input())
l = []
f = 0
l.append(N)
if N % 10 == 0:
	N = N + 1
	l.append(N)
while True:
	while N % 10 != 0:
		N = N + 1
		if N % 10 == 0:
			break
		elif N in l:
			f = 1
			break
		l.append(N)
	while N % 10 == 0:
		N = int(N / 10)
	if N in l or f == 1:
		break
	else:
		l.append(N)
print(len(l))


def function(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x
visited = set()
n = int(input())
new = n
while new not in visited:
	visited.add(new)
	new = function(new)
print(len(visited))


import sys
input = sys.stdin.readline

def main():
	x = int(input())

	def f(x):
		x += 1
		while x % 10 == 0:
			x //= 10
		return x
	seen = set()
	while x not in seen:
		seen.add(x)
		x = f(x)
	print(len(seen))
main()


def f(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return x

def main():
	n = int(input())
	res = set()
	while True:
		if n in res:
			break
		res.add(n)
		n = f(n)
	print(len(res))
main()


def f(n):
	m = n + 1
	while m % 10 == 0:
		m = m / 10
	return m
n = int(input())
fSet = [n]
fNext = n
while True:
	fNext = f(fNext)
	if fNext in fSet:
		break
	fSet.append(fNext)
print(len(fSet))


n = int(input())

def f(n, s):
	if n < 10:
		return
	else:
		n += 1
		while n % 10 == 0:
			n //= 10
		s.add(n)
		f(n, s)
if n < 10:
	print(9)
else:
	s = set()
	s.add(n)
	f(n, s)
	print(len(s) + 8)


import sys
n = int(input())
res = 1
mi = n
n += n == 1
x = n % 10 == 0
n += x
res += x
while True:
	if n < 10:
		res += 8
		break
	x = 10 - n % 10 - 1
	res += x
	n = (n + 9) // 10 * 10
	while n % 10 == 0:
		n //= 10
	if n != mi:
		res += 1
	mi = n
print(res)


def solve():
	N = int(input())
	numbers = set([N])
	N += 1
	while True:
		while N % 10 > 0:
			numbers.add(N)
			N += 1
		while N % 10 == 0:
			N //= 10
		if N in numbers:
			break
		numbers.add(N)
	print(len(numbers))
solve()


N = int(input())
L = [N]

def f(n):
	n = n + 1
	if n % 10 == 0:
		while n % 10 == 0:
			n //= 10
	return n
while True:
	if f(N) in L:
		break
	else:
		L.append(f(N))
		N = f(N)
print(len(L))


from sys import stdin
input = stdin.readline
n = int(input())
s = set()
while n not in s:
	s.add(n)
	n += 1
	while str(n)[-1] == '0':
		n = int(str(n)[:len(str(n)) - 1])
print(len(s))


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
a = set()
n = int(input())
while not n in a:
	a.add(n)
	n = f(n)
print(len(a))


def func(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
n = int(input())
s = {n}
while True:
	n = func(n)
	if n in s:
		break
	s.add(n)
print(len(s))


x = int(input())
cnt = 0
while True:
	if x >= 1 and x <= 9:
		cnt += 9
		break
	x += 1
	while x % 10 == 0:
		x //= 10
	cnt += 1
print(cnt)


n = input()
a = [int(_) for _ in list(n)[::-1]]
r = 9
for i in range(len(a) - 1):
	a[i + 1] = a[i + 1] + 1
	r += 10 - a[i]
print(r)


l = input()
n = int(l)
c = 0
t = int(l[0]) + 1
k = 0
if int(n / 10) == 0:
	print(9)
else:
	while k != 2:
		n = n + 1
		c = c + 1
		while n % 10 == 0:
			if n == t:
				k = k + 1
			n = n / 10
		if n == t:
			k = k + 1
	print(c)


n = int(input())

def f(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return x
if n <= 9:
	print(9)
else:
	cnt = 1
	while True:
		n = f(n)
		if n <= 9:
			break
		cnt += 1
	print(cnt + 9)


n = int(input())
x = 1
while n > 9:
	n += 1
	while n % 10 == 0:
		n //= 10
	x += 1
print(x + 8)


def frn(n):
	tmp = n + 1
	tmp = str(tmp)
	tmp = tmp[::-1]
	tmp = int(tmp)
	tmp = str(tmp)
	tmp = tmp[::-1]
	tmp = int(tmp)
	return tmp

def main():
	n = int(input())
	tmp = n
	respuesta = []
	respuesta.append(n)
	while True:
		tmp = frn(tmp)
		if tmp in respuesta:
			break
		else:
			respuesta.append(tmp)
	print(len(respuesta))
main()


i = int(input().rstrip())
reach = set()

def fn(n):
	global reach
	if n not in reach:
		while n % 10 == 0:
			n //= 10
		reach.add(n)
		fn(n + 1)
fn(i + 1)
reach.add(i)
print(len(reach))


temp_num = int(input())
total = []
total.append(temp_num)
while temp_num > 9:
	temp_num = temp_num + 1
	while temp_num % 10 == 0:
		temp_num = temp_num / 10
	total.append(temp_num)
print(len(total) + 8)


def cal(n):
	y = n % 10
	while y == 0 and n != 0:
		n //= 10
		y = n % 10
	return n
n = int(input())
c = 9
if n < 10:
	print(9)
	exit()
while n >= 10:
	n += 1
	if n % 10 == 0:
		n = cal(n)
		c += 1
	else:
		c += 1
print(c)


n = list(map(int, list(input())))
ans = 9
for i in range(1, len(n)):
	if i == len(n) - 1:
		ans += 10 - n[i]
	else:
		ans += 9 - n[i]
print(ans)


def hd(x):
	d = x + 1
	if str(d)[-1] == '0':
		y = int(str(d)[:-1])
		while str(y)[-1] == '0':
			y = int(str(y)[:-1])
		return y
	else:
		return d
n = int(input(''))
li = n
i = 1
while len(str(li)) != 1:
	li = hd(li)
	i += 1
i = i + 8
print(i)


n = int(input())
l = list()
ans = 0
while n not in l:
	l.append(n)
	n = n + 1
	while n % 10 == 0:
		n = int(n / 10)
	ans = ans + 1
print(ans)


n = int(input())
Ans = 9
ANS = []
ANS.append(n)
while True:
	n += 1
	Ans += 1
	a = list(reversed(list(str(n))))
	ans = []
	nol = False
	for i in range(len(a)):
		if a[i] != '0' or nol:
			ans.append(a[i])
		if a[i] != '0':
			nol = True
	n = int(''.join(reversed(ans)))
	if n in ANS:
		break
	else:
		ANS.append(n)
print(len(ANS))


def f(x):
	num = x + 1
	if num % 10 == 0:
		while num % 10 == 0:
			num = int(num / 10)
		return num
	else:
		return num
n = int(input())
sum = 0
mark = 0
ans = set()
while mark < 2:
	ans.add(n)
	sum += 1
	n = f(n)
	if n == 9:
		mark += 1
print(len(ans))


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	n = sint()
	cnt = 0
	if n % 10 == 0:
		cnt += 10
		n += 10
		while n % 10 == 0:
			n //= 10
	while n // 10 >= 1:
		add = 10 - n % 10
		cnt += add
		n += add
		while n % 10 == 0:
			n //= 10
	cnt += 9
	print(cnt)
main()


def f(v):
	v += 1
	while v % 10 == 0:
		v = v // 10
	return v

def run():
	n = int(input())
	ans = 1
	nums = set()
	flag = False
	while n not in nums:
		nums.add(n)
		n = f(n)
	print(len(nums))
run()


import math

def end0(x):
	if x % 10 == 0:
		return True
	else:
		return False

def f(i):
	x = i + 1
	while end0(x):
		x = x // 10
	return x
n = int(input())
s = set()
i = n
while f(i) != 1:
	s.add(f(i))
	i = f(i)
s.add(1)
s.add(n)
arr = [2, 3, 4, 5, 6, 7, 8, 9]
for i in arr:
	if i not in s:
		s.add(i)
print(len(s))


n = list(input())
if len(n) == 1:
	print(9)
else:
	total = 0
	v = int(n[-1])
	total += 10 - v
	for i in range(len(n) - 1):
		if i == 0:
			total += 9
		else:
			v = int(n[i])
			if v != 9:
				total += 9 - v
	print(total)


n = int(input())
c = 0
while n >= 10:
	r = 10 - n % 10
	n = n + r
	c += r
	while n % 10 == 0:
		n //= 10
c += 9
print(c)


n = int(input())
dict1 = {}
flag = 0
dict1[n] = 1
while flag == 0:
	n += 1
	while n % 10 == 0:
		n = n // 10
	try:
		dict1[n] += 1
		flag = 1
	except:
		KeyError
		dict1[n] = 1
print(len(dict1))


n = int(input())
lst = []
if n < 10:
	p = 0
else:
	p = 1
if n > 1:
	while n != 1:
		n += 1
		while n % 10 == 0:
			n //= 10
		if n not in lst:
			lst.append(n)
if not 2 in lst:
	n = 19
	while n != 1:
		n += 1
		while n % 10 == 0:
			n //= 10
		if n not in lst:
			lst.append(n)
print(len(lst) + p)


n = int(input())
tot = 0

def removeTrailingZeroes(num):
	while num % 10 == 0:
		num = num // 10
	return num
while n // 10 != 0:
	n += 1
	rem = n % 10
	if rem == 0:
		n = removeTrailingZeroes(n)
		tot += 1
	else:
		tot += 1
print(tot + 9)


def solve_old(num):
	results = set([num])
	new_num = func(num)
	while new_num not in results:
		results.add(new_num)
		new_num = func(new_num)
	results.add(new_num)
	return len(results)

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
a = set()
n = int(input())
while n not in a:
	a.add(n)
	n = f(n)
print(len(a))


n = int(input())
s = set()
cnt = 0
while not n in s:
	cnt = cnt + 1
	s.add(n)
	n = n + 1
	while n % 10 == 0:
		n //= 10
print(cnt)


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def f1(x):
	x += 1
	while x % 10 == 0:
		x = x // 10
	return x

def solve():
	n = f()[0]
	s = set()
	s.add(n)
	while f1(n) not in s:
		n = f1(n)
		s.add(n)
	print(len(s))
solve()


def dar(a):
	while a % 10 == 0:
		a = a // 10
	return a
n = int(input())
x = []
m = n
while 1:
	n += 1
	if n % 10 == 0:
		n = dar(n)
		if n in x:
			break
		else:
			x.append(n)
	elif n in x:
		break
	else:
		x.append(n)
if m in x:
	pass
else:
	x.append(m)
print(len(x))


s = input()
l = len(s)
if l == 1:
	ans = 9
else:
	ans = 19 - int(s[l - 1])
	s = s[1:l - 1]
	for i in s:
		ans += 9 - int(i)
print(ans)


from collections import defaultdict as dd
n = int(input())
ans = 1
d = dd(int)
d[n] = 1
while 1:
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n //= 10
	if d[n] != 0:
		break
	else:
		ans += 1
		d[n] = 1
print(ans)


def f(x):
	x += 1
	while not x % 10:
		x //= 10
	return x
a = set()
n = int(input())
while n not in a:
	a.add(n)
	n = f(n)
print(len(a))


n = int(input())
s = set()
c = 0
while n not in s:
	s.add(n)
	n = int(str(n + 1).rstrip('0'))
	c += 1
print(c)


n = int(input())
li = {n}
while True:
	n += 1
	if n % 10 != 0:
		if n not in li:
			li.add(n)
		else:
			break
	else:
		while n % 10 == 0:
			n //= 10
		if n not in li:
			li.add(n)
		else:
			break
print(len(li))


def f(num):
	num = int(num)
	num += 1
	num = str(num)
	while num[-1] == '0':
		num = num[:-1]
	return num
n = int(input())
L = []
i = 1
L.append(str(n))
while True:
	n = f(n)
	if n in L:
		break
	L.append(n)
	i += 1
print(i)


def reachable(inp):
	ret = inp + 1
	if ret % 10 != 0:
		return ret
	while ret % 10 == 0:
		ret = ret / 10
	return ret

def main():
	reachable_list = list()
	inp = int(input())
	num = inp
	reachable_list.append(num)
	while True:
		num = int(reachable(num))
		if num in reachable_list:
			break
		else:
			reachable_list.append(num)
	print(len(reachable_list))
main()


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inar():
	return [int(k) for k in input().split()]

def main():
	n = int(input())
	ans = 1
	dic = {}
	dic[n] = 1
	while 1:
		num = n + 1
		while num % 10 == 0:
			num = num // 10
		if num in dic:
			break
		dic[num] = 1
		ans += 1
		n = num
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
result = 0
if not n % 10:
	result = 1
	n += 1
while n > 10:
	n += 1
	while not n % 10:
		if n < 10:
			break
		n = n // 10
	else:
		result += 1
result += 9
print(result)


def f(n):
	n += 1
	while str(n)[-1] == '0':
		n = int(str(n)[:-1])
	return n
n = int(input())
c = 1
while n >= 10:
	n = f(n)
	c += 1
print(c + 8)


q = int(input())
w = True
e = [q]
while w:
	q = q + 1
	r = True
	while r:
		if q % 10 == 0:
			q = q // 10
		else:
			r = False
	e.append(q)
	if len(e) != len(list(set(e))):
		break
print(len(e) - 1)


def f(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return int(x)

def reachable_numbers(n):
	c = 0
	while n > 9:
		n = f(n)
		c += 1
	return c + 9
n = int(input())
print(reachable_numbers(n))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
a = int(input())
c = 0
while a > 9:
	a = f(a)
	c += 1
print(c + 9)


def fun(x):
	x += 1
	str1 = str(x).strip('0')
	a = int(str1)
	return a
n = int(input())
tmp = -1
l = []
while not tmp in l:
	l.append(tmp)
	tmp = n
	n = fun(n)
print(len(l) - 1)


def process(n):
	l = list(str(n))
	for i in range(len(l) - 1, 0, -1):
		if l[i] is not '0':
			break
		l.pop()
	return int(''.join(l))
n = int(input())
l = [n]
while True:
	n = l[-1] + 1
	if process(n) in l:
		break
	l.append(process(n))
print(len(l))


n = int(input())
v = [n]
while 1:
	n += 1
	while not n % 10:
		n //= 10
	if n in v:
		break
	v += (n,)
print(len(v))


n = list(map(int, input()))
r = 10 if len(n) > 1 else 9
for v in n[1:]:
	r += 9 - v
print(r)


N = int(input())

def f(x):
	x += 1
	x = str(x)
	while x[-1] == '0':
		x = x[:-1]
	return x
prev = set()
prev.add(N)
n = N
while int(f(n)) not in prev:
	tmp = int(f(n))
	prev.add(tmp)
	n = tmp
print(len(prev))


n = input()
n = int(n)
L = [n]
temp = n
while 1:
	temp = temp + 1
	while temp % 10 == 0:
		temp = int(temp / 10)
	if temp in L:
		break
	else:
		L.append(temp)
print(len(L))


num = eval(input())
list = [num]
while True:
	num += 1
	str2 = repr(num)
	str2 = str2.rstrip('0')
	num = eval(str2)
	if list.count(num):
		break
	list.append(num)
print(len(list))


def func(b):
	b += 1
	while b % 10 == 0:
		b /= 10
	return b
a = int(input())
s = set()
while a not in s:
	s.add(a)
	a = func(a)
print(len(s))


n = int(input())
c = set()
c.add(n)
o = True
while n != 1 or o:
	if n == 1:
		o = False
	n += 1
	n = int(str(n).strip('0'))
	c.add(n)
print(len(c))


def removeTrailings(n):
	while n % 10 == 0:
		n /= 10
	return n
n = int(input())
l = []
l.append(n)
i = n
while True:
	i = removeTrailings(i + 1)
	if i not in l:
		l.append(i)
	else:
		break
print(len(l))


def func(n):
	x = n + 1
	new_x = int(str(x).strip('0'))
	return new_x
n = int(input())
l = []
value = func(n)
while not value in l:
	l.append(value)
	value = func(value)
if n in l:
	print(len(l))
else:
	print(len(l) + 1)


n = input()
LIST = []
while len(n) > 1:
	LIST.append(n)
	n = str(int(n) + 1)
	while n[-1] == '0':
		n = n[:-1]
SET = set(LIST) | {'1', '2', '3', '4', '5', '6', '7', '8', '9'}
print(len(SET))


def myfun(n):
	val = n + 1
	while val % 10 == 0:
		val //= 10
	return val
num = int(input())
mset = set()
mset.add(num)
while myfun(num) not in mset:
	mset.add(myfun(num))
	num = myfun(num)
print(len(mset))


def advance(n):
	n += 1
	while n % 10 == 0:
		n = n // 10
	return n
n = int(input())
count = 1
used = []
while n not in used:
	used.append(n)
	n = advance(n)
print(len(used))


def zero(n):
	while n % 10 == 0 and n > 0:
		n = n // 10
	return n

def find(a, n):
	l = len(a)
	ret = False
	i = 0
	while i < l and ret == False:
		if a[i] == n:
			ret = True
		i += 1
	return ret

def reach(n):
	check = False
	a = []
	a.append(n)
	ret = 1
	while check == False:
		n += 1
		n = zero(n)
		if find(a, n) == False:
			a.append(n)
			ret += 1
		else:
			check = True
	return ret
n = int(input())
print(reach(n))


def cut_trailing(n):
	while n % 10 == 0:
		n = n // 10
	return n

def a_func(n):
	res_list = []
	res_list.append(n)
	n += 1
	while True:
		n = cut_trailing(n)
		if n not in res_list:
			res_list.append(cut_trailing(n))
			n += 1
		else:
			break
	return len(res_list)
n = int(input())
print(a_func(n))


def f(n):
	x = str(n + 1)
	while len(x) and x[-1] == '0':
		x = x[:-1]
	return int(x)
n = int(input())
ans = 0
vis = {}
while n not in vis.keys():
	ans += 1
	vis.update({n: True})
	n = f(n)
print(ans)


n = int(input())
temp = n
ans = 0
n = str(n)
k = n[0]
n = int(n)
k = int(k)
while 1:
	n += 1
	n = str(n)
	ans += 1
	n = n.strip('0')
	n = int(n)
	if n == k:
		break
if temp < 10:
	print(ans)
else:
	print(ans + 1)


import math

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def pr(x):
	used = set()
	used.add(x)
	k = 10 - x % 10
	for i in range(x, x + k):
		if i % 10 != 0:
			used.add(i)
	x += k
	if x % 10 != 0:
		used.add(x)
	while x > 1:
		knn = 0
		while x % 10 == 0:
			x //= 10
		kn = 10 - x % 10
		if x == 1:
			for i in range(1, 10):
				used.add(i)
			used.add(x)
			return len(used)
		for i in range(x, x + kn):
			if i % 10 != 0:
				used.add(i)
			else:
				break
		x += kn
		k += kn + knn
	return len(used)
n = int(input())
print(pr(n))


def foo(x):
	return int(str(x + 1).strip('0'))
ans = 1
l = []
n = int(input())
l.append(n)
while True:
	n = foo(n)
	if n in l:
		print(ans)
		exit()
	else:
		ans += 1
		l.append(n)


def func(a):
	b = str(a + 1)
	while b[-1] == '0':
		b = b[0:len(b) - 1]
	return int(b)
i = int(input())
li = [i]
while True:
	i = func(i)
	if i in li or i == li[0]:
		break
	li.append(i)
print(len(li))


n = input()
res = 0
prev_number = 0
for el in reversed(n[1:]):
	if int(el) + prev_number != 10:
		res += 10 - (int(el) + prev_number)
	prev_number = 1
print(res + 9)


n = int(input())

def f(x):
	x = x + 1
	x = int(str(int(str(x)[::-1]))[::-1])
	return x
visited = []
while n not in visited:
	visited.append(n)
	reached = f(n)
	n = reached
print(len(visited))


def f(n):
	n = n + 1
	n = str(n)
	while n[-1] == '0':
		n = n[:-1]
	return int(n)
n = int(input())
ans = set()
ans.add(n)
while True:
	n = f(n)
	if n not in ans:
		ans.add(n)
	else:
		break
print(len(ans))


n = int(input(' ').strip(' '))
nStr = str(n)
count = 0
nList = []
while True:
	if n in nList:
		break
	nList.append(n)
	count += 1
	n += 1
	while n % 10 == 0:
		n = n // 10
print(count)


n = int(input())
listReachable = list()
listReachable.append(n)
while True:
	n = n + 1
	while True:
		if n % 10 == 0:
			n = n / 10
		else:
			break
	if n not in listReachable:
		listReachable.append(n)
	else:
		break
print(len(listReachable))


n = int(input())
count = 0
while n >= 10:
	count += 10 - n % 10
	n = n // 10 + 1
	while n % 10 == 0:
		n = n // 10
print(count + 9)


s = input()
x = set([s])
flag = 2
while flag:
	if s == '1':
		flag -= 1
	s = str(int(s) + 1)
	while True:
		if s[-1] == '0':
			s = s[:len(s) - 1]
		else:
			break
	x.add(s)
print(len(x))


def f(x):
	x += 1
	while x % 10 == 0:
		x /= 10
	return x

def reachables(n):
	if n < 10:
		return 9
	return reachables(f(n)) + 1
print(reachables(int(input())))


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
n = sInt()
a = []
c = 0
while True:
	a.append(n)
	n += 1
	while n % 10 == 0:
		n = n // 10
	if n in a:
		break
print(len(a))


n = int(input())

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
c = 0
if n <= 9:
	print(9)
else:
	while n > 9:
		n = f(n)
		c += 1
	print(c + 9)


n = int(input())
lst = []
lst.append(n)
n += 1
while True:
	while n % 10 == 0:
		n = n / 10
	if n in lst:
		break
	else:
		lst.append(n)
	n += 1
print(len(lst))


n = int(input())
s = 1
while n // 10 != 0:
	n += 1
	s += 1
	while n % 10 == 0:
		n = n // 10
s += 8
print(s)


def p(x):
	s = []
	while 1:
		if x not in s:
			s.append(x)
			x += 1
			while x % 10 == 0:
				x /= 10
		else:
			break
	return len(set(s))
ip = int(input())
print(p(ip))


x = int(input())

def f(x):
	if x + 1 % 10 == 0 or x % 10 == 0:
		if x + 1 % 10 == 0:
			return (x + 1) / 10
		else:
			return x / 10
	else:
		return x + 1
lst = [x]
if x == 10:
	lst.append(1)
if x % 10 == 0:
	lst.append(x + 1)
	x = x + 1
while f(x) not in lst:
	x = f(x)
	while x % 10 == 0:
		x = f(x)
	lst.append(x)
print(len(list(set(lst))))


def f(a):
	a += 1
	while a % 10 == 0:
		a //= 10
	return a
a = int(input())
i = 1
while a > 9:
	a = f(a)
	i += 1
print(8 + i)


import sys
input = sys.stdin.readline

def main():

	def f(n):
		n += 1
		while n % 10 == 0:
			n /= 10
		return n
	n = int(input())
	stk = [n]
	mk = {}
	while stk:
		x = stk.pop()
		if x in mk:
			continue
		mk[x] = 1
		stk.append(f(x))
	print(len(mk))
main()


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n
primes = []

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	else:
		return int(input())
n = f()
count = 1
st = True
mx = -1
e = 0
while n >= 10:
	n += 1
	while n % 10 == 0:
		n = n // 10
	count += 1
print(count + 8)


def f(n):
	n += 1
	while n % 10 == 0:
		n = n // 10
	return n
a = set()
N = int(input())
while N not in a:
	a.add(N)
	N = f(N)
print(len(a))


n = int(input())
result = 1
if n < 10:
	result = 0
n = n + 1
while n >= 10:
	if n % 10:
		result += 10 - n % 10
		n += 10
	n = n // 10
result += 9
print(result)


n = int(input())
wyn = 0
dz = 0
myk = [0] * 11
while True:
	if n < 11:
		myk[n] += 1
		if myk[n] > 1:
			break
	wyn += 1
	n += 1
	while True:
		if n % 10 == 0:
			n = n // 10
		else:
			break
print(wyn)


x = int(input())
set = []
y = x
x = x + 1
while x not in set:
	if x % 10 == 0:
		x = x / 10
	else:
		set.append(x)
		x += 1
if (y % 10 == 0 or (y + 1) % 10 == 0 or y > 10) and y != 9:
	print(len(set) + 1)
else:
	print(len(set))


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
cou = []
one = 0
a = int(input())
while one < 9:
	if a not in cou:
		cou.append(a)
	if a < 10:
		one += 1
	a = f(a)
print(len(cou))


m = int(input())
res = []
while True:
	m += 1
	if m in res:
		break
	res.append(m)
	trailed_m = str(m).rstrip('0')
	m = int(trailed_m)
print(len(res))


def zerorm(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n
n = int(input())
cnt = 1
if n // 10 == 0:
	cnt = 0
while True:
	n = zerorm(n)
	if n // 10 == 0:
		break
	cnt += 1
cnt += 9
print(cnt)


def qwe(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
a = int(input())
c = 0
s = []
while a not in s:
	s.append(a)
	a = qwe(a)
	c += 1
print(c)


def cal(x):
	if x < 10:
		return 9
	c = 1
	dic = {}
	x += 1
	while True:
		if x % 10 == 0:
			x = str(x)
			x = x[:-1]
			x = int(x)
		else:
			if x % 10 != 0:
				if x in dic:
					break
				dic[x] = 0
				c += 1
			x = int(x) + 1
			if x % 10 != 0:
				if x in dic:
					break
	return c
x = int(input())
print(cal(x))


def solve():
	N = int(input())

	def f(n):
		n += 1
		lst = list(str(n))
		startidx = 0
		endidx = 0
		for (e, l) in enumerate(lst):
			if l == '0':
				continue
			else:
				startidx = e
				break
		length = len(lst)
		for (e, l) in enumerate(reversed(lst)):
			if l == '0':
				continue
			else:
				endidx = length - e
				break
		sep = lst[startidx:endidx]
		ret = ''.join(sep)
		return int(ret)
	ans = set()
	while not N in ans:
		ans.add(N)
		N = f(N)
	print(len(ans))
	return
solve()


n = int(input())
cou = 1
lol = 0
l = [n]
n += 1
lo = 0
if n == 2:
	lo = 1
while n != 1:
	while n % 10 == 0:
		n = n // 10
	if n == 1:
		lol += 1
	if lol == 2:
		break
	if n % 10 != 0:
		if n not in l:
			cou += 1
			l.append(n)
		n += 1
print(cou)


from sys import stderr

def readint():
	return int(input())

def readfloat():
	return float(input())

def readarray(n, f=input):
	return [f() for i in range(n)]

def readlinearray(f=int):
	return list(map(f, input().split()))

def euclide(a, b):
	if a < 0:
		(g, x, y) = euclide(-a, b)
		return (g, -x, y)
	if b < 0:
		(g, x, y) = euclide(a, -b)
		return (g, x, -y)

def gen_primes(max):
	primes = [1] * (max + 1)
	for i in range(2, max + 1):
		if primes[i]:
			for j in range(i + i, max + 1, i):
				primes[j] = 0
	primes[0] = 0
	return [x for x in range(max + 1) if primes[x]]

def is_prime(N):
	if N % 2 == 0:
		return N == 2
	i = 3
	while i * i <= N:
		if N % i == 0:
			return False
		i += 2
	return True

def answer():
	return ''

def gcj():
	n = readint()
	was = set(range(1, 10))
	while n > 8:
		was.add(n)
		n += 1
		while n % 10 == 0:
			n //= 10
	print(len(was))
gcj()


n = int(input().strip())
ctr = 9

def f(n):
	n_dot = n + 1
	while n_dot % 10 == 0:
		n_dot = n_dot // 10
	return n_dot
has = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
if n not in has:
	has.add(n)
	ctr += 1
while n != 1:
	n = f(n)
	if n not in has:
		ctr += 1
		has.add(n)
print(ctr)


n = int(input())
l = [n]
n += 1
test = True
while test:
	while n % 10 == 0:
		n //= 10
	if n not in l:
		l.append(n)
	else:
		test = False
	n += 1
print(len(l))


def f(x):
	x += 1
	while x > 0 and x % 10 == 0:
		x //= 10
	return x
n = int(input())
v = set()
c = 0
while n > 0:
	if n in v:
		break
	c += 1
	v.add(n)
	n = f(n)
print(c)


def main():
	n = int(input())
	a = set()
	a.add(n)
	a.add(1)
	n = n + 1
	while n not in a:
		while n % 10 == 0:
			n = n // 10
		a.add(n)
		n += 1
	print(len(a))
main()


a = int(input())
s = set()
while True:
	s.add(a)
	x = len(s)
	a = a + 1
	while a % 10 == 0:
		a /= 10
	s.add(a)
	if len(s) == x:
		break
print(len(s))


def f(n):
	n += 1
	while n % 10 == 0:
		n //= 10
	return n

def solve():
	N = int(input())
	ans = 1
	memo = set()
	memo.add(N)
	while True:
		N = f(N)
		if N in memo:
			break
		ans += 1
		memo.add(N)
	return ans
print(solve())


N = int(input())

def f(n):
	n += 1
	while n % 10 == 0:
		n = n // 10
	return n
nums = set()
nums.add(N)
prev = 1
while True:
	N = f(N)
	nums.add(N)
	if prev == len(nums):
		break
	prev = len(nums)
print(len(nums))


def f(n):
	i = 1
	while (n + 1) % 10 == 0:
		n = n // 10
	return n + 1
n = int(input())
a = [n]
while f(n) not in a:
	a.append(f(n))
	n = f(n)
print(len(a))


def nu(c):
	if c // 10 * 10 == c:
		return nu(c // 10)
	else:
		return c
n = int(input())
k = 0
s = set()
while n not in s:
	s.add(n)
	k += 1
	n += 1
	n = nu(n)
print(k)


N = int(input())
count = 9
while N > 9:
	count += 10 - N % 10
	N = N // 10 + 1
	while N % 10 == 0:
		N = N // 10
print(count)


n = int(input())

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
nums = set()
nums.add(n)
for i in range(1, 10):
	nums.add(i)
while n > 1:
	n = f(n)
	nums.add(n)
print(len(nums))


n = int(input())
k = n + 1
c = 1
if k <= 10:
	c = 9
else:
	while k != 1:
		while k % 10 == 0:
			k = k / 10
		if k <= 9:
			c = c + 9
			break
		c = c + 1
		k = k + 1
print(c)


n = int(input())
d = {n: 1}
x = 1
while x:
	n += 1
	while n % 10 == 0:
		n //= 10
	try:
		d[n]
		print(len(d))
		break
	except:
		d[n] = 1


import sys

def f(k):
	k += 1
	while k % 10 == 0:
		k //= 10
	return k
n = 0
for line in sys.stdin:
	if n == 0:
		n = int(line)
		break
reachable = {n}
n = f(n)
while n not in reachable:
	reachable.add(n)
	n = f(n)
print(len(reachable))


from sys import stdin

def ip():
	return [int(i) for i in stdin.readline().split()]

def sp():
	return [str(i) for i in stdin.readline().split()]

def solve():
	n = int(input())
	st = set()
	n += 1
	ans = 0
	while n not in st:
		st.add(n)
		ans += 1
		while n % 10 == 0:
			n = n // 10
		n += 1
	return ans
print(solve())


from collections import Counter

def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
(n,) = map(int, input().split())
was = set()
cnt = 0
while n not in was:
	cnt += 1
	was.add(n)
	n = f(n)
print(cnt)


def f(x):
	x = x + 1
	while not x % 10:
		x = x / 10
	return int(x)
x = int(input())
i = 0
a = []
while True:
	y = x
	for z in range(i):
		y = f(y)
	if y in a:
		break
	a.append(y)
	i += 1
print(len(a))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()

def main():
	n = input()
	d = {}
	while True:
		if n in d:
			break
		d[n] = 1
		x = list(str(int(n) + 1))
		while x[-1] == '0':
			x.pop()
		n = ''.join(x)
	print(len(d))
main()


n = int(input())
cnt = 1
while n >= 10:
	n += 1
	while n % 10 == 0:
		n //= 10
	cnt += 1
print(cnt + 8)


s = list(input())
res = 0
l = len(s)
if l == 1:
	print(9)
	quit()
for i in range(l):
	if i == l - 1:
		res += 10 - int(s[i])
	else:
		res += 10 - int(s[i]) - 1
res += int(s[0])
print(res)


def fun(n):
	x = n + 1
	while x % 10 == 0:
		x //= 10
	return x
lista = []
n = int(input())
lista.append(n)
t = fun(n)
while not t in lista:
	lista.append(t)
	t = fun(t)
print(len(lista))


n = int(input())
L = list()
B = True
c = 0
min = n
while B:
	L.append(n)
	c += 1
	n += 1
	while n % 10 == 0:
		n = n // 10
	i = 0
	while i < c:
		if L[i] == n:
			B = False
		i += 1
print(c)


def f(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
N = int(input())
s = set()
while N not in s:
	s.add(N)
	N = f(N)
print(len(s))


def remove_zero(n, arr):
	if n in arr:
		return arr
	if n % 10 == 0:
		return remove_zero(n / 10, arr)
	else:
		arr.append(int(n))
		return remove_zero(n + 1, arr)
arr = []
n = int(input())
remove_zero(n + 1, arr)
if not n in arr:
	arr.append(n)
print(len(arr))


x = int(input())
s = {x: 1}
a = 0
while True:
	a += 1
	x += 1
	while x % 10 == 0:
		x = x // 10
	try:
		aa = s[x]
		a -= 1
		break
	except:
		pass
	s[x] = 1
print(len(s.keys()))


def f(n):
	if n < 10:
		return 9
	res = 10 - n % 10
	n += res
	while n % 10 == 0:
		n = int(n / 10)
	return res + f(n)
n = int(input())
print(f(n))


def f(x):
	y = x + 1
	if y % 10 == 0:
		for i in reversed(range(len(str(y)))):
			if y % 10 ** i == 0:
				return int(y / 10 ** i)
		pass
	else:
		return int(y)
x = int(input())
l = []
y = x
while True:
	x = f(x)
	if x not in l:
		l.append(x)
	else:
		break
if y in l:
	print(len(l))
else:
	print(len(l) + 1)


n = int(input())
c = 0
if n >= 10:
	res = 1
	n = n + 1
	while n != 1:
		if n % 10 == 0:
			n /= 10
		else:
			c = 10 - n % 10
			n = n + c
			res += c
		if n < 10:
			res += 8
			break
	print(int(res + 1))
else:
	print('9')


a = input()
a = int(a)
if a < 10:
	print(9)
	exit()
ans = int(10)
while a > 9:
	t = int(a % 10)
	a = int(a / 10)
	ans = int(ans + 9 - t)
print(ans)


def f(num):
	num = str(num + 1)
	while num[len(num) - 1] == '0':
		num = num[slice(len(num) - 1)]
	return int(num)
inp = int(input())
(count, term) = (0, inp)
reach = set()
while term not in reach:
	reach.add(term)
	term = f(term)
	count += 1
print(count)


def f(n):
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	return n
n = int(input())
ctr = 0
nums = {}
while n not in nums:
	nums[n] = True
	ctr += 1
	n = f(n)
print(ctr)


n = int(input())
s = set()
i = 0
s.add(str(n))
while True:
	k = str(n + 1).strip('0')
	n = int(k)
	if k in s:
		break
	s.add(k)
print(len(s))


n = int(input())
a = 0
while n >= 10:
	n += 1
	a += 1
	while n % 10 == 0:
		n = n // 10
print(a + 9)


def findReachable(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x

def main():
	n = int(input())
	ls = [n]
	while True:
		if findReachable(n) in ls:
			print(len(ls))
			break
		else:
			ls.append(findReachable(n))
			n = findReachable(n)
			findReachable(n)
main()


x = int(input())
ans = 9
while x > 9:
	nx = x + 10
	nx //= 10
	nx *= 10
	ans += nx - x
	x = nx
	while x % 10 == 0:
		x //= 10
print(ans)


In = input
rint = lambda : int(In())
rmint = lambda : map(int, In().split())
rlist = lambda : list(rmint())
n = rint()

def f(x):
	x += 1
	if x % 10:
		return x
	s = str(x).rstrip('0')
	if not len(s):
		return 0
	else:
		return int(s)
a = set([n])
while 1:
	n = f(n)
	if n in a:
		break
	a.add(n)
print(len(set(a)))


def find(x):
	know = set([])
	know.add(x)
	while True:
		x += 1
		while x % 10 == 0:
			x = x // 10
		if x in know:
			break
		know.add(x)
	return len(know)
print(find(int(input())))


a = input()
alle = set()
alle.add(int(a))
while True:
	x = int(a)
	x += 1
	y = str(x)
	while y[-1] == '0':
		y = y[:-1]
	if int(y) in alle:
		break
	alle.add(int(y))
	a = y
print(len(alle))


def solve(n):
	if n < 10:
		return 9
	ret = 10
	while n > 9:
		ret += 9 - n % 10
		n //= 10
	return ret
print(solve(int(input())))


inp = lambda : int(input())
strl = lambda : list(input().strip())
seq = lambda : list(map(int, input().strip().split()))

def results(n):
	a = set()

	def f(t):
		t += 1
		while t % 10 == 0:
			t = t // 10
		return t
	while not n in a:
		a.add(n)
		n = f(n)
	return len(a)

def main():
	t = inp()
	print(results(t))
main()


n = int(input())
count = 0
for i in str(n)[::-1]:
	count += 10 - (int(i) + 1)
if len(str(n)) == 1:
	print(count + int(str(n)[0]))
else:
	print(count + int(str(n)[0]) + 1)


def f(x):
	x += 1
	while x % 10 == 0:
		x = x / 10
	return x
b = int(input())
a = set()
while not b in a:
	a.add(b)
	b = f(b)
print(len(a))


x = input()
n = int(x)
p = n
c = 10
while n >= 10:
	r = n % 10
	c += 9 - r
	n = n // 10
if p < 10:
	print('9')
else:
	print(c)


n = int(input())
list = []
while list.count(n) == 0:
	list.append(n)
	n += 1
	while n % 10 == 0:
		n //= 10
print(len(list))


def f(n):
	n += 1
	while n % 10 == 0:
		n = int(n / 10)
	return n
n = int(input())
s = {}
s[n] = True
while True:
	n = f(n)
	if s.get(n):
		break
	s[n] = True
print(len(s))


import math
n = int(input())
count = 1
while n >= 10:
	n += 1
	while n % 10 == 0:
		n //= 10
	count += 1
count += 8
print(count)


n = int(input())
num = 9
while len(str(n)) != 1:
	num += 1
	n += 1
	while n % 10 == 0:
		n //= 10
print(num)


n = int(input())
if n < 10:
	count = 1
else:
	n += 1
	count = 2
while True:
	if n >= 10:
		if n % 10 == 0:
			while n % 10 == 0:
				n = n // 10
		else:
			count += 1
			n += 1
	else:
		break
print(count + 8)


import sys
import math

def main(args):
	n = int(input())
	numbers = set()
	while n not in numbers:
		numbers.add(n)
		n = int(str(n + 1).strip('0'))
	print(len(numbers))
sys.exit(main(sys.argv))


n = int(input())

def fun(x):
	t = x + 1
	while t % 10 == 0:
		t = t / 10
	return t
c = 1
while 1:
	if n < 10:
		print(c + 8)
		break
	n = fun(n)
	c = c + 1


def f(x):
	x = x + 1
	while x % 10 == 0:
		x //= 10
	return x
n = int(input())
seen = {n: True}
x = n
while True:
	x = f(x)
	if x in seen:
		break
	seen[x] = True
print(len(seen))


import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def solve(d):
	xy = [MIN, MAX]
	for rt in d:
		if xy[0] > rt[1]:
			return -1
		if xy[1] < rt[0]:
			return -1
		xy[0] = max(xy[0], rt[0])
		xy[1] = min(xy[1], rt[1])
	return xy

def main():
	n = iin()
	c = 0
	p = set()
	while 1:
		n += 1
		if n in p:
			break
		p.add(n)
		c += 1
		n = str(n)
		n = int(n.rstrip('0'))
	print(c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
count = 0
c = 0
z = ''
while len(str(n)) != 1:
	co = 10 - n % 10
	count += co
	n = str(n + co)
	for i in range(len(n) - 1, 0, -1):
		if n[i] == '0':
			c += 1
		else:
			break
	n = int(n) // pow(10, c)
	c = 0
count += 9
print(count)


n = int(input())
c = {}
while n not in c:
	c[n] = 1
	n += 1
	while 0 == n % 10:
		n /= 10
print(len(c))


n = int(input())
l = [n]
t = 100000
while t > 0:
	t -= 1
	n += 1
	while n % 10 == 0:
		n //= 10
	l.append(n)
l = list(set(l))
print(len(l))


def func(num):
	while True:
		if num % 10 == 0:
			num = num // 10
		else:
			break
	return num
n = int(input())
d = {}
d[n] = 1
n += 1
while True:
	x = func(n)
	if x in d:
		break
	else:
		d[x] = 1
	n = x + 1
print(len(d))


s = input()
sum = 0
i = -1
if len(s) > 1:
	sum = sum + 10 - int(s[len(s) - 1])
for i in range(len(s) - 2, 0, -1):
	sum = sum + (10 - int(s[i])) - 1
print(sum + 9)


def trans(x):
	x += 1
	x = str(x).rstrip('0')
	return int(x)
n = int(input())
A = set()
while n not in A:
	A.add(n)
	n = trans(n)
print(len(A))


n = int(input())
l = []
a = n + 1
while True:
	while str(a)[-1] == '0':
		a = a // 10
	if a in l:
		break
	else:
		l.append(a)
	a += 1
if n in l:
	print(len(l))
else:
	print(len(l) + 1)


def cal(n):
	while n % 10 == 0:
		n /= 10
	return n
n = int(input())
ans = 0
ar = []
while ar.count(n) == 0:
	ans += 1
	ar.append(n)
	n += 1
	n = cal(n)
print(ans)


import math
n = int(input())
ans = 0
if n % 10 == 0:
	n += 1
	ans = 1
while 1:
	if n < 10:
		ans += 9
		break
	elif n % 10:
		ans += 10 - n % 10
		n = (n // 10 + 1) * 10
	else:
		while n % 10 == 0:
			n //= 10
print(ans)


n = int(input())
s = set()
while n not in s:
	s.add(n)
	n = int(str(n + 1).strip('0'))
print(len(s))


def fun(n):
	c = 1
	if n // 10 == 0:
		return 9
	n += 1
	while n % 10 > 0:
		c += 1
		n += 1
	while n % 10 == 0:
		n //= 10
	return c + fun(n)
n = int(input())
print(fun(n))


s = 10
a = input()
if len(a) == 1:
	s -= 1
for i in range(1, len(a)):
	s += 9 - int(a[i])
print(s)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
s = input()
if len(s) == 1:
	print(9)
	exit()
n = int(s)
n += 1
s = str(n)
ans = 9
c = 0
while n > 9:
	k = int(s[-1])
	n = int('0' + s[:-1])
	if k == 0:
		s = s[:-1]
		continue
	ans += 9 - k + 1
	n += 1
	s = str(n)
print(ans + 1)


n = int(input())
count = 1
l = [n]
while True:
	n = n + 1
	while n % 10 == 0:
		n = n // 10
	if n in l:
		break
	l.append(n)
	count = count + 1
print(count)


n = int(input())
a = [n]

def find_out(n):
	n = n + 1
	while n % 10 == 0:
		n //= 10
	if not n in a:
		a.append(n)
		return find_out(n) + 1
	else:
		return 1
print(find_out(n))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def abs(x):
	return x if x >= 0 else -x

def sumelem(x, start, end):
	sum = 0
	for i in range(start, end + 1):
		sum += x[i]
	return sum
cnt = set()
for t in range(1):
	number = input()
	while number not in cnt:
		cnt.add(number)
		number = str(int(number) + 1).rstrip('0')
	if number == '10':
		cnt.add(1)
	print(len(cnt))


n = int(input())
l = []
l.append(n)
T = n + 1
C = list(str(T))
V = len(C)
for i in range(len(C) - 1, -1, -1):
	if C[i] == '0':
		V = i
	else:
		break
D = C[0:V]
T = int(''.join(D))
while T not in l:
	l.append(T)
	T = T + 1
	C = list(str(T))
	V = len(C)
	for i in range(len(C) - 1, -1, -1):
		if C[i] == '0':
			V = i
		else:
			break
	D = C[0:V]
	T = int(''.join(D))
print(len(l))


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
if n < 10:
	print(9)
else:
	li = [n]
	while 1:
		n += 1
		s = str(n)
		if s[-1] == '0':
			c = 0
			l = len(s)
			for i in range(l - 1, -1, -1):
				if s[i] == '0':
					c += 1
				else:
					break
			s = s[:l - c]
			n = int(s)
			if n not in li:
				li.append(n)
			else:
				break
		elif n not in li:
			li.append(n)
		else:
			break
	print(len(li))


n = int(input())

def fn(x):
	y = x + 1
	if y % 10 == 0:
		while y % 10 == 0:
			y = y / 10
	return y
a = []

def tf(ele, l):
	if ele in l:
		return 'false'
	else:
		return 'true'
while not n in a:
	a.append(n)
	n = fn(n)
print(len(a))


def solve(x):
	ans = 9
	s = str(x)
	if len(s) == 1:
		return ans
	for c in s[1:len(s)]:
		ans += ord('9') - ord(c)
	return ans + 1
x = input()
print(solve(int(x)))


from collections import defaultdict
n = int(input())
count = 0
reachable = defaultdict(int)
while reachable[n] == 0:
	reachable[n] = 1
	count += 1
	n += 1
	while n % 10 == 0:
		n //= 10
print(count)


S = input()
if S == '0':
	print(10)
else:
	Somme = 1
	for k in S[1:]:
		Somme += 9 - int(k)
	Somme += 9
	if len(S) == 1:
		Somme -= 1
	print(Somme)


from collections import defaultdict
a = int(input())
al = defaultdict(int)
count = 1
al[a] = 1
a += 1
while 1:
	while a % 10 == 0:
		a = a // 10
	if al[a] == 0:
		al[a] = 1
		a += 1
		count += 1
		continue
	else:
		break
print(count)


d = []
n = int(input())
d.append(n)

def x(ff):
	global d
	ff += 1
	while ff % 10 == 0:
		ff = ff // 10
	return ff
o = 0
while True:
	o += 1
	n = x(n)
	if n not in d:
		d.append(n)
	else:
		break
print(len(d))


n = int(input())
t = 0
while n > 9:
	n += 1
	while n % 10 == 0:
		n //= 10
	t += 1
print(t + 9)


n = int(input())
s = set()
x = n
s.add(x)
ans = 0
while 1:
	x = x + 1
	while x % 10 == 0:
		x //= 10
	if x in s:
		break
	else:
		s.add(x)
		ans += 1
print(len(s))


n = int(input())
cur = n + 0
ans = dict()
while cur not in ans.keys():
	ans[cur] = True
	cur += 1
	while cur % 10 == 0:
		cur = cur // 10
print(len(ans.keys()))


num = int(input())

def getSum(num):
	return sum([int(i) for i in str(num)])

def f(num):
	if num[-1] != '0':
		return int(num)
	return f(num[:-1])
reachable = [num]
while True:
	num = f(str(num + 1))
	if num not in reachable:
		reachable.append(num)
	else:
		break
print(len(reachable))


n = int(input())
b = n
n += 1
s = []
g = str(n)
h = True
while h or g[-1] == 0:
	if g[-1] == '0':
		g = g[:-1]
	if g[-1] != '0' and g not in s:
		s.append(g)
		g = str(int(g) + 1) + '0'
	elif g in s:
		h = False
		break
if b < 10:
	print(len(s))
else:
	print(len(s) + 1)


N = int(input())
Cou = 0
Min = 10000000000
PrevMin = 10000000000
while (N != Min) & (N != PrevMin):
	if N < Min:
		PrevMin = Min
		Min = N
	N += 1
	while N % 10 == 0:
		N /= 10
	Cou += 1
print(Cou)


a = int(input())

def proc(x):
	x += 1
	while x % 10 == 0:
		x //= 10
	return x
u = []
while a > 0:
	if a not in u:
		u.append(a)
		a = proc(a)
	else:
		print(len(u))
		exit()


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
import sys
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]
import timeit

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())

def countOverlapping(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
n = ii()

def f(n):
	nc = int(n)
	seen = set()
	while True:
		n += 1
		while n % 10 == 0:
			n //= 10
		if n in seen:
			break
		else:
			seen.add(n)
	print(len(seen) + (1 if nc not in seen else 0))
f(n)


def f(k):
	for i in mas:
		if k == i:
			return False
	return True
a = int(input())
mas = []
while f(a):
	mas.append(a)
	a = a + 1
	while a % 10 == 0:
		a = int(a // 10)
print(len(mas))


from sys import stdin, stdout
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
t = int(input())
i = 0
f = []
f.append(t)
c = 1
while True:
	r = f[i] + 1
	while r % 10 == 0:
		r /= 10
	if r not in f:
		c += 1
		i += 1
		f.append(r)
	else:
		break
print(c)


n = int(input())
count = 0
while True:
	count += 10 - n % 10
	if n // 10 == 0:
		count += n % 10 - 1
		break
	n += 10 - n % 10
	while n % 10 == 0:
		n //= 10
print(count)


def ans(n):
	if n < 10:
		return 9
	ret = 10 - n % 10
	n = n // 10 + 1
	while n % 10 == 0:
		n /= 10
	return ret + ans(n)
n = int(input())
print(int(ans(n)))


a = int(input())
count = 0
if 1 <= a <= 9:
	print(9)
	exit()
if a % 10 == 0:
	a = a + 1
	count = 1
while a > 9:
	count = count + 10 - a % 10
	a = a + 10 - a % 10
	while a % 10 == 0:
		a = a // 10
count = count + 9
print(count)


n = int(input())
ls = [n]

def func(n, ls):
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n //= 10
	if n not in ls:
		ls.append(n)
	return (n, ls)
for x in range(100):
	(n, ls) = func(n, ls)
print(len(ls))


n = int(input())
dic = {}
while 1:
	if n in dic:
		break
	else:
		dic[n] = 1
	n += 1
	if n % 10 == 0:
		while n % 10 == 0:
			n = n // 10
print(len(dic))


def foo(n):
	n += 1
	while n % 10 == 0:
		n /= 10
	return n
ans = set()
n = int(input())
while n not in ans:
	ans.add(n)
	n = foo(n)
print(len(ans))


t = int(input())
ansl = []
ans = 0
temp = t
while ans not in ansl:
	t = str(t + 1)
	t = int(t.strip('0'))
	ans = int(t) + 1
	ansl.append(t)
ansl.append(temp)
ansl = set(ansl)
print(len(ansl))


n = int(input())
reachables = {n}
while n != 0:
	n += 1
	while n % 10 == 0 and n != 0:
		n //= 10
	if n in reachables:
		break
	reachables.add(n)
print(len(reachables))


from sys import stdin, stdout

def fn(s):
	if len(s) == 1:
		return 9
	last = s[:-1] + '9'
	op = int(last) - int(s) + 1
	last = str(int(last) + 1)
	while last[-1] == '0':
		last = last[:-1]
	return op + fn(last)
for _ in range(1):
	s = input()
	ans = fn(s)
	print(ans)


n = int(input())
counter = 9
while n >= 10:
	counter += 10 - n % 10
	n += 10 - n % 10
	while n % 10 == 0:
		n //= 10
print(counter)


n = int(input())
c = 1
used = {n}
while True:
	n += 1
	c += 1
	while not n % 10:
		n //= 10
	if n in used:
		break
	else:
		used.add(n)
print(len(used))


import sys
if len(sys.argv) >= 2:
	if sys.argv[1] == 'LOCAL':
		sys.stdin = open('input.in', 'r')
num = input()
ans = 10
n = len(num)
i = 1
while i < n:
	ans += 9 - int(num[i])
	i += 1
if int(num) < 10:
	ans = 9
print(ans)


x = int(input())
if x < 10:
	ans = 0
else:
	ans = 1
while x >= 10:
	x += 1
	while x % 10 == 0:
		x /= 10
	if x >= 10:
		ans += 1
print(ans + 9)


n = int(input())
(t, c) = (0, 0)
while n // 10 != 0:
	m = n % 10
	t += 9 - m
	n = n // 10
	c += 1
if c == 0:
	print(9)
else:
	print(9 + t + 1)