Eighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered Vova that n is the answer to the arithmetic task for first-graders. In the textbook, a certain positive integer x was given. The task was to add x to the sum of the digits of the number x written in decimal numeral system.

Since the number n on the board was small, Vova quickly guessed which x could be in the textbook. Now he wants to get a program which will search for arbitrary values of the number n for all suitable values of x or determine that such x does not exist. Write such a program for Vova.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 10^9).


-----Output-----

In the first line print one integer k — number of different values of x satisfying the condition. 

In next k lines print these values in ascending order.


-----Examples-----
Input
21

Output
1
15

Input
20

Output
0



-----Note-----

In the first test case x = 15 there is only one variant: 15 + 1 + 5 = 21.

In the second test case there are no such x.

Difficulty: EASY
Tags: Mathematics

Complete search
Skill types: Complete search

Starter code:

Solutions:
import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
ans = 0
vals = []
for i in range(n, max(n - 100, -1), -1):
	s = str(i)
	this = 0
	for j in s:
		this += int(j)
	if i + this == n:
		ans += 1
		vals.append(i)
print(ans)
vals.sort()
for i in vals:
	print(i)


n = int(input())

def get_num_digits(n):
	i = 0
	while n:
		n //= 10
		i += 1
	return i

def get_sum_digits(n):
	s = 0
	while n:
		(n, ost) = divmod(n, 10)
		s += ost
	return s
i = get_num_digits(n)
m = n - i * 9
m = 0 if m < 0 else m
res = []
for k in range(m, n):
	if k + get_sum_digits(k) == n:
		res.append(k)
if res:
	print(len(res))
	for r in res:
		print(r)
else:
	print(0)


t = 1
for _ in range(t):
	n = int(input())
	nn = n
	cnt = 0
	while nn:
		nn = nn // 10
		cnt += 1
	a = n - cnt * 9
	a = max(a, 0)
	l = []
	for i in range(a, n):
		summ = i
		ii = i
		while ii:
			summ += ii % 10
			ii = ii // 10
		if summ == n:
			l.append(i)
	print(len(l))
	print(*l)


def sumOfDigits(n):
	lst = list(str(n))
	count = 0
	for i in lst:
		count += int(i)
	return count
n = int(input())
sett = []
if n == 2:
	print(1, 1, sep='\n')
else:
	for i in range(n, max(n - len(str(n)) * 9, 0), -1):
		if sumOfDigits(i) + i == n:
			sett.append(i)
	print(len(sett))
	for x in range(len(sett) - 1, -1, -1):
		print(sett[x])


n = input()
l = len(n)
i = int(n)
res = []
for x in range(max(0, i - l * 9), i):
	if i == x + sum(map(int, str(x))):
		res.append(str(x))
print(len(res))
if res:
	print('\n'.join(res))


def main():
	n = int(input())
	solver(n)

def solver(n):
	k = 0
	nums = []
	for x in range(n - 9 * digitCount(n) - 9, n):
		if x + sumOfDigits(x) == n:
			k += 1
			nums.append(x)
	print(k)
	for x in nums:
		print(x)

def digitCount(n):
	count = 0
	while n > 0:
		n //= 10
		count += 1
	return count

def sumOfDigits(n):
	total = 0
	while n > 0:
		total += n % 10
		n //= 10
	return total
main()


def sum_str(n):
	if n < 0:
		return -1
	sumi = int(n)
	for i in str(n):
		sumi += int(i)
	return sumi

def main():
	ans = []
	s = int(input())
	for i in range(1, 120):
		if sum_str(s - i) == s:
			ans.append(s - i)
	ans.sort()
	print(len(ans))
	if len(ans) != 0:
		print('\n'.join([str(i) for i in ans]))
main()


n = int(input())
output = []
for i in range(max(n - 80, 0), n):
	listi = list(map(int, str(i)))
	if i + sum(listi) == n:
		output.append(i)
print(len(output))
for i in range(len(output)):
	print(output[i])


a = int(input())
if a > 100:
	b = a - 100
	b = str(b)
	l = []
	count = 0
	ans = []
	for j in range(int(b), a):
		l.append(j)
	for n in l:
		k = []
		for i in range(len(str(n))):
			k.append(int(str(n)[i]))
		if n + sum(k) == a:
			ans.append(n)
			count += 1
else:
	count = 0
	ans = []
	l = []
	for i in range(a):
		l.append(i)
	for j in l:
		k = []
		for m in range(len(str(j))):
			k.append(int(str(j)[m]))
		if j + sum(k) == a:
			ans.append(j)
			count += 1
print(count)
ans.sort()
if count != 0:
	for x in ans:
		print(x, end=' ')


n = input()
D = sum([int(d) for d in n])
N = int(n)
a = []
for d in range(1, 101):
	if d >= N:
		continue
	num = N - d
	digits = 0
	for x in str(num):
		digits += int(x)
	if digits == d:
		a.append(num)
a.sort()
print(len(a))
for x in a:
	print(x)


n = int(input())
ans = [i for i in range(max(0, n - 100), n) if i + sum((int(j) for j in str(i))) == n]
print(len(ans), '\n' + '\n'.join(map(str, ans)))


value = int(input())

def display(lst):
	for item in sorted(lst):
		print(item)

def sum_a_string(integer):
	return sum([int(d) for d in str(integer)])

def make_all_nine(lenght):
	return '9' * lenght

def d_max(value):
	svalue = str(value)
	value_len = len(svalue)
	first = svalue[0]
	if value_len == 1:
		return value
	if first == '1':
		return sum_a_string(int(make_all_nine(value_len - 1)))
	nines_count = value_len - 1
	first = str(int(first) - 1)
	return sum_a_string(int(first + make_all_nine(nines_count)))

def itter(value):
	count = 0
	possible_digits = []
	if value == 1:
		print(count)
		display(possible_digits)
		return
	for num in range(value - d_max(value), value):
		result = num + sum_a_string(num)
		if result == value:
			count += 1
			possible_digits.append(num)
	print(count)
	display(possible_digits)
itter(value)


def S(a):
	su = 0
	for i in str(a):
		su += int(i)
	return su
n = int(input())
x = max(0, n - 100)
res = []
for i in range(x, n + 1):
	if i + S(i) == n:
		res.append(i)
print(len(res))
print(*res)


n = int(input())
temp = []
for x in range(max(0, n - 100), n):
	temp2 = str(x)
	sd = 0
	for i in temp2:
		sd += int(i)
	if sd + x == n:
		temp.append(x)
print(len(temp))
for i in temp:
	print(i)


s = input()

def ch_c(x):
	c = 0
	l = []
	for i in range(1, len(x) * 9 + 1):
		if int(x) - i > 0 and int(x) - i + o_s(int(x) - i) == int(x):
			c += 1
			l.append(int(x) - i)
	l.append(c)
	return l

def o_s(n):
	x = sum(list(map(int, str(n))))
	return x
o = ch_c(s)
print(o[-1])
for i in range(len(o) - 2, -1, -1):
	print(o[i])


n = int(input())
s = str(n)
l = len(s)
if n < 11:
	if n % 2 == 0:
		print(1)
		print(n // 2)
	else:
		print(0)
elif n < 18 and n % 2 == 0:
	print(1)
	print(n // 2)
elif n == 11:
	print(1)
	print(10)
elif n == 13:
	print(1)
	print(11)
elif n == 15:
	print(1)
	print(12)
elif n == 17:
	print(1)
	print(13)
else:
	x = n - l * 9
	i = x
	f = 0
	c = 0
	lst = []
	s1 = 0
	while i < n:
		s1 = 0
		sx = str(i)
		for j in range(len(sx)):
			s1 += int(sx[j])
		if s1 + i == n:
			f = 1
			c += 1
			lst.append(i)
		i += 1
	if f == 0:
		print(0)
	else:
		print(c)
		for j in range(c):
			print(lst[j], end=' ')


def calc(n):
	return sum(list(map(int, list(str(n)))))
n = int(input())
ans = []
for i in range(n - 1, max(0, n - 1000), -1):
	if i + calc(i) == n:
		ans.append(i)
print(len(ans))
ans.sort()
for i in ans:
	print(i)


def main():
	n = int(input())
	results = foo(n)
	print(len(results))
	for i in results:
		print(i)

def foo(n):
	results = []
	min_border = n - len(str(n)) * 9
	for i in range(max(min_border, 0), n):
		if i + sum_of_digits(i) == n:
			results.append(i)
	return results

def sum_of_digits(n, result=0):
	while n > 0:
		result += n % 10
		n = n // 10
	return result

def test1():
	assert foo(21) == [15]

def test2():
	assert foo(20) == []

def test3():
	foo(1000000)

def __starting_point():
	main()
__starting_point()


import sys

def main():
	n = int(sys.stdin.readline().rstrip())
	xVals = []
	for i in range(n - 1000, n):
		if n == i + sumDigits(i):
			xVals.append(i)
	print(len(xVals))
	if len(xVals) > 0:
		print(' '.join(map(str, xVals)))

def sumDigits(x):
	ret = 0
	while x > 0:
		ret += x % 10
		x = x // 10
	return ret
main()


n = int(input())
total = 0
list = []
start = 0 if n < 1000 else n - 100
for x in range(start, n):
	if n == x + sum(map(int, str(x))):
		total += 1
		list.append(x)
print(total)
for i in list:
	print(i)


def digits_sum(n):
	return sum(list(map(int, list(str(n)))))
n = int(input())
cnt = 0
ans = []
for i in range(n - min([100, n - 1]), n):
	if i + digits_sum(i) == n:
		ans.append(i)
		cnt += 1
print(cnt)
if cnt > 0:
	print(' '.join(map(str, ans)))


def sum_digits(n):
	ans = 0
	while n > 0:
		ans += n % 10
		n = n // 10
	return ans
n = int(input())
ans = []
for i in range(max(1, n - 1000), n + 1):
	if i + sum_digits(i) == n:
		ans.append(i)
print(len(ans))
for elem in ans:
	print(elem)


divisors = [100000001, 10000001, 1000001, 100001, 10001, 1001, 101, 11, 2]
number = int(input())
stack = [(number, 0, [])]
solutions = list()
while stack:
	(number, divisor_pos, solution) = stack.pop()
	if divisor_pos == len(divisors):
		if number == 0:
			solutions.append(''.join(solution))
	else:
		divisor = divisors[divisor_pos]
		new_digit = number // divisor
		if new_digit < 10:
			new_solution = solution.copy()
			new_solution.append(repr(new_digit))
			new_state = (number % divisor, divisor_pos + 1, new_solution)
			stack.append(new_state)
		if 0 < new_digit < 11:
			new_solution = solution.copy()
			new_solution.append(repr(new_digit - 1))
			new_state = (number - (new_digit - 1) * divisor, divisor_pos + 1, new_solution)
			stack.append(new_state)
print(len(solutions))
solutions = map(int, solutions)
solutions = map(repr, solutions)
print('\n'.join(solutions))


n = input()
p = len(n)
c = 0
list1 = []
g = int(n) - 9 * p
if g < 0:
	g = 0
for i in range(g, int(n)):
	c = c + i
	str1 = str(i)
	for j in str1:
		c += int(j)
	if c == int(n):
		list1.append(i)
	c = 0
print(len(list1))
list1.sort()
print(*list1)


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

def sum_digits(x):
	return sum([int(i) for i in x])
for i in range(max(0, n - 80), n):
	if i + sum_digits(str(i)) == n:
		res.append(i)
print(len(res))
if len(res) != 0:
	for r in sorted(res):
		print(r)


temp = []
n = int(input())
for q in range(1, 82):
	t = n - q
	if t >= 0:
		sum = 0
		for s in str(t):
			sum = sum + int(s)
		if sum == q:
			temp.append(t)
print(len(temp))
temp = sorted(temp)
for t_e in temp:
	print(t_e)


n = int(input())
a = []
for i in range(n, n - 100, -1):
	temp = i
	ans = temp
	while temp > 0:
		ans += temp % 10
		temp = temp // 10
	if ans == n:
		a.insert(0, i)
print(len(a))
for x in a:
	print(x)


n = int(input())
m = []
if n <= 18:
	a = 0
else:
	a = n - len(str(n)) * 9
for i in range(a, n):
	x = i
	for j in str(i):
		x += int(j)
	if n == x:
		m.append(i)
print(len(m))
[print(i) for i in m]


from math import ceil, log2

def dig(n):
	q = n
	v = 0
	while q:
		v += q % 10
		q //= 10
	return v + n
n = int(input())
if n == 2:
	print(1)
	print(1)
else:
	d = 0
	q = n
	while q:
		q = q // 10
		d += 1
	store = []
	for i in range(max(0, n - 9 * d), n):
		if dig(i) == n:
			store.append(i)
	print(len(store))
	print(*store, sep='\n')


n = int(input())
s = len(str(n))
t = max(0, n - 9 * s)
c = 0
l = []
for i in range(t, n):
	m = str(i)
	if i + sum([int(i) for i in list(m)]) == n:
		l.append(i)
		c += 1
print(c)
if l != []:
	for i in l:
		print(i)


def main():
	n = input()
	mn = int(n)
	res = []
	for x in range(max([mn - len(n) * 10, 1]), mn):
		msum = sum(map(int, list(str(x))))
		if x + msum == mn:
			res.append(str(x))
	print('{}\n{}'.format(len(res), '\n'.join(res)))
main()


n = int(input())
x = 0
L = []
if n > 100:
	for i in range(n - 81, n):
		s = i % 10
		for j in range(1, 10):
			s += i // 10 ** j % 10
		if i + s == n:
			x += 1
			L.append(i)
elif n < 101:
	for i in range(1, n):
		s = i % 10 + i // 10
		if i + s == n:
			x += 1
			L.append(i)
if L == []:
	print(0)
else:
	print(x)
	for i in L:
		print(i)


def decnums(n):
	v = []
	dec = 10
	while n >= dec:
		v.append(n % dec)
		n = n // dec
	v.append(n)
	return v

def iscornum(n, c):
	sumnums = sum(decnums(c))
	return n == c + sumnums
n = int(input())
v = []
delta = len(decnums(n))
for c in range(n - 1, n - 9 * delta, -1):
	if c <= 0:
		break
	if iscornum(n, c):
		v.append(c)
print(len(v))
v.sort()
for c in v:
	print(c)


n = int(input())
answer = []
for i in range(max(1, n - 1000), n):
	if i + sum(map(int, str(i))) == int(n):
		answer.append(int(i))
print(len(answer), *answer, sep='\n')


def sum_digits(x):
	res = 0
	while x > 0:
		res += x % 10
		x //= 10
	return res
n = int(input())
res = []
for i in range(81, 0, -1):
	if n - i + sum_digits(n - i) == n:
		res.append(n - i)
print(len(res))
for i in res:
	print(i)


n = int(input())
p = 0 if n <= 100 else n - 100
ans = []
while p <= n:
	k = p
	s = p
	while k > 0:
		s += k % 10
		k = k // 10
	if s == n:
		ans.append(p)
	p += 1
if len(ans) == 0:
	print(0)
else:
	print(len(ans))
	for i in ans:
		print(i)


import math
n = int(input())
t = math.ceil(math.log(n, 10))
k = n - 9 * t
c = 0
a = []
majmooe_arqam = 0
if n < 20:
	k = 1
while k <= n:
	arqam = str(k)
	for i in range(len(arqam)):
		majmooe_arqam += int(arqam[i])
	if k + majmooe_arqam == n:
		c += 1
		a.append(k)
	k += 1
	majmooe_arqam = 0
print(c)
for x in a:
	print(x, end=' ')


n = int(input())
v = [x for x in range(max(1, n - 81), n) if x + sum(map(int, str(x))) == n]
print(len(v))
for vi in v:
	print(vi)


def d(n):
	sm = 0
	while n:
		sm += n % 10
		n = n // 10
	return sm
n = int(input())
cnt = 0
ans = []
for j in range(max(n - 90, 0), n + 1, 1):
	if j + d(j) == n:
		cnt += 1
		ans.append(j)
print(cnt)
print(*ans)


n = int(input())
a = []
for i in range(1, 100):
	x = n - i
	s = 0
	if x < 1:
		continue
	for j in str(x):
		s += int(j)
	if x + s == n:
		a.append(x)
if len(a) == 0:
	print(0)
else:
	a.sort()
	print(len(a))
	for i in a:
		print(i)


class CodeforcesTask875ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0

	def read_input(self):
		self.n = int(input())

	def process_task(self):
		sols = []
		for x in range(100):
			res = self.n - x
			if res > 0:
				well = res + sum([int(j) for j in str(res)])
				if well == self.n:
					sols.append(res)
		sols.sort()
		self.result = '{0}\n{1}'.format(len(sols), '\n'.join([str(x) for x in sols]))

	def get_result(self):
		return self.result
Solution = CodeforcesTask875ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


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

def ms(x):
	x = str(x)
	v = 0
	for i in x:
		v += int(i)
	return v
for i in range(n, max(n - 111, 0), -1):
	if i + ms(i) == n:
		a.append(i)
a.sort()
print(len(a))
for i in a:
	print(i)


a = int(input().strip())
imin = max(0, a - 81)
l = []
for i in range(imin, a):
	x = list(str(i))
	s = 0
	for xx in x:
		s += int(xx)
	if s + i == a:
		l.append(i)
print(len(l))
for e in l:
	print(e)


n = int(input())
sol = []
for i in range(max(n - 9 * 9, 0), n):
	str_i = str(i)
	digits = [int(c) for c in str_i]
	if i + sum(digits) == n:
		sol.append(i)
print(str(len(sol)))
for s in sol:
	print(s)


def sumDigits(x):
	return sum(list(map(int, str(x))))
n = int(input())
counter = 0
theNumbers = []
digits = len(str(n))
for i in range(max(n - digits * 9, 0), n):
	if i + sumDigits(i) == n:
		theNumbers.append(i)
		counter += 1
print(counter)
for j in range(len(theNumbers)):
	print(theNumbers[j])


n = int(input())
li = [x for x in range(max(1, n - 99), n) if x + sum(map(int, str(x))) == n]
print(len(li))
print(*li)


def sum_digs(n):
	count = 0
	for item in str(n):
		count += int(item)
	return count
n = int(input())
val = sum_digs(n)
list1 = []
count = 0
for x in range(100):
	if x > n:
		break
	if sum_digs(n - x) == x:
		count += 1
		list1.append(n - x)
list1.sort()
print(count)
for x in range(count):
	print(list1[x])


i = int(input(''))
list = []
leng = 1
iter = i
while iter >= 10:
	iter
	j = iter % 10
	iter //= 10
	leng += 1
count = 0
result = []
begin = 1
if leng * 10 < i:
	begin = i - leng * 10
for it in range(begin, i):
	iter = it
	list.clear()
	while iter >= 10:
		j = iter % 10
		iter //= 10
		list.append(j)
	list.append(iter)
	list.reverse()
	summ = sum(list)
	if summ + it == i:
		count += 1
		result.append(it)
print(count)
if count != 0:
	for i in result:
		print(i)


n = int(input())

def digit_sum(n):
	dgsum = 0
	while n > 0:
		dgsum += n % 10
		n = n // 10
	return dgsum
xs = []
for sd in range(1, 100):
	if sd > n:
		continue
	if digit_sum(n - sd) == sd:
		xs.append(n - sd)
if len(xs) == 0:
	print(0)
else:
	print(len(xs))
	xs.sort()
	print('\n'.join(map(str, xs)))


def f(x):
	res = x
	while x:
		res += x % 10
		x //= 10
	return res
n = int(input())
cnt = 0
ans = []
for i in range(max(0, n - 180), n):
	if f(i) == n:
		cnt += 1
		ans.append(i)
print(cnt)
for i in ans:
	print(i)


from collections import Counter
import string
import math
import sys

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

def vary(number_of_variables):
	if number_of_variables == 1:
		return int(sys.stdin.readline())
	if number_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
mod = 100000007
array = []

def solve(i, n, val, ans):
	global array
	if i == -1:
		return
	if val == n:
		array.append(ans // 10)
		return
	if val + 10 ** i + 9 * i < n or val > n:
		return
	for j in range(10):
		solve(i - 1, n, val + j * (10 ** (i - 1) + 1), ans + j * 10 ** i)
n = int(input())
solve(10, n, 0, 0)
print(len(array))
for i in range(len(array)):
	print(array[i])


n = int(input())

def s(x):
	return x + sum(map(int, list(str(x))))
ans = [i for i in range(max(1, n - 100), n) if s(i) == n]
print(len(ans))
for i in ans:
	print(i)


import sys
import math
import bisect

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

def solve(n):
	A = []
	for i in range(1, 100):
		if n > i and query_digit_sum(n - i) == i:
			A.append(n - i)
	A.sort()
	return A

def main():
	n = int(input())
	ans = solve(n)
	print(len(ans))
	for a in ans:
		print(a)
main()


n = int(input())
q = []
for i in range(max(0, n - 100), n + 1):
	j = i
	res = i
	while j:
		res += j % 10
		j //= 10
	if res == n:
		q.append(i)
print(len(q))
for i in q:
	print(i)


n = int(input())
x = n
z = 0
t = 0
fty = []
for i in range(min(1000, n)):
	z = 0
	x = str(x)
	for j in range(len(x)):
		z += int(x[j])
	x = int(x)
	if x + z == n:
		t += 1
		fty += [x]
	x -= 1
fty.sort()
if t == 0:
	print(t)
else:
	print(t)
	for i in fty:
		print(i)


(n, a, y) = (int(input()), [1, 2, 3, 4, 5, 6, 7, 8, 9], [])
x = n - 99 if n > 99 else 1
for i in range(x, n):
	sum = 0
	for j in str(i):
		sum += int(j)
	if sum + i == n:
		y.append(i)
print(len(y))
print(*y)


def summ(x):
	return sum([int(i) for i in str(x)])
n = int(input())
ans = []
for i in range(max(1, n - 200), n):
	if i + summ(i) == n:
		ans.append(i)
print(len(ans))
print(*ans)


x = []
for i in range(0, 11):
	x.append(0)
res = 0
aRes = []
a = int(input())

def sum(n):
	s = 0
	while n > 0:
		s += n % 10
		n = n // 10
	return s
for i in range(0, 82):
	if a - i + sum(a - i) == a:
		res += 1
		aRes.append(a - i)
aRes.sort()
print(res)
for i in range(0, res):
	print(aRes[i])


n = int(input())
a = []
no = 0
i = 0
while i < 82 and i <= n:
	b = n - i
	b = list(str(b))
	z = 0
	for ele in b:
		z += int(ele)
	if i == z:
		no += 1
		a.append(n - i)
	i += 1
a.sort()
print(no)
for ele in a:
	print(ele)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
arr = []
n = ii()

def ok(a, b):
	for i in a:
		b -= ord(i) - ord('0')
	return b == 0
for i in range(101):
	if ok(str(n - i), i):
		arr.append(n - i)
print(len(arr))
print(*sorted(arr))


from collections import deque as de
import math
from collections import Counter as cnt

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

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 get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic
n = int(input())
temp = n
temp = str(temp)
ans = []
if n <= 10:
	if n % 2:
		print(0)
	else:
		print(1)
		print(n // 2)
else:
	ll = (len(temp) - 1) * 9 + (int(temp[0]) - 1)
	for i in range(1, ll + 1):
		dd = str(n - i)
		if i == sum(list(map(int, dd.strip()))):
			ans.append(int(dd))
	if len(ans) == 0:
		print(0)
	else:
		print(len(ans))
		ans.sort()
		print(*ans, end='\n')


def f(x):
	t = 0
	while x:
		t += x % 10
		x //= 10
	return t
n = int(input())
output = []
num = 0
for i in range(100):
	if n - i <= 0:
		break
	elif f(n - i) == i:
		num += 1
		output.append(n - i)
print(num)
output.sort()
for i in range(num):
	print(output[i])


def sumdig(x):
	s = 0
	if x > 0:
		for i in str(x):
			s += int(i)
		return s
	else:
		for i in str(x)[1:]:
			s += int(i)
		return s * -1
n = int(input())
r = 0
i = n - 9 * (len(str(n)) - 1) - 10
k = 0
ka = []
while i <= n:
	r = i + sumdig(i)
	if r == n:
		k += 1
		ka.append(i)
	i += 1
if k == 0:
	if len(str(n)) == 1:
		if n % 2 == 0:
			print(1)
			print(n // 2)
		else:
			print(k)
	else:
		print(k)
else:
	print(k)
	for i in ka:
		print(i)


(n, X) = (int(input()), [])
for x in range(max(1, n - 99), n):
	if x + sum(map(int, str(x))) == n:
		X.append(x)
print(len(X))
print(*X)


n = input()
s = 0
p = []
if len(n) < 3:
	k = 0
else:
	k = int(n) - 100
for i in range(k, int(n)):
	suma = 0
	for j in str(i):
		suma += int(j)
	if suma + i == int(n):
		p.append(int(i))
		s += 1
print(s)
for j in p:
	print(j)


n = int(input())

def digit_sum(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s

def digit_count(n):
	count = 0
	while n > 0:
		count += 1
		n //= 10
	return count
x_count = 0
x_list = []
for x in range(n - 9 * digit_count(n), n + 1):
	if x + digit_sum(x) == n:
		x_list.append(x)
		x_count += 1
print(x_count)
for x in x_list:
	print(x)


def fun(n):
	return sum((int(n[i]) for i in range(0, len(n))))
n = int(input())
p = []
for i in range(1, min(100, n + 1)):
	if i == fun(str(n - i)):
		p.append(n - i)
p = sorted(p)
print(len(p))
for i in range(0, len(p)):
	print(p[i])


n = int(input())
a = []
for i in range(100, 0, -1):
	if n <= i:
		continue
	x = n - i
	if sum(map(int, list(str(x)))) == i:
		a.append(x)
print(len(a))
for i in a:
	print(i, end=' ')


def solve(n1):
	summ1 = 0
	temp = n1
	while temp != 0:
		summ1 += temp % 10
		temp = temp // 10
	return summ1
n = input()
r = len(n)
n = int(n)
rr = 9 * r
summ = solve(n)
cnt = 0
A = []
for i in range(n - rr, n):
	if i + solve(abs(i)) == n:
		cnt += 1
		A.append(i)
print(cnt)
for j in A:
	print(j)


a = int(input())
ans = 0
z = []
for i in range(81, 0, -1):
	s = 0
	p = a - i
	while p > 0:
		s += p % 10
		p //= 10
	if s == i:
		ans += 1
		z += [a - i]
print(ans, '\n '.join(map(str, z)), sep='\n')


def sumOfdig(x):
	ans = 0
	while x:
		ans += x % 10
		x //= 10
	return ans
n = int(input().strip())
x = n - 1
ans = []
while x > max(0, n - 101):
	if sumOfdig(x) + x == n:
		ans.append(x)
	x -= 1
print(len(ans))
print('\n'.join(list(map(str, sorted(ans)))))


num1 = int(input())
t = num1
c = 0
s = 0
list2 = []
for d in range(max(1, num1 - 100), num1):
	num1 -= 1
	s += num1
	f = list(str(num1))
	for i in f:
		s += int(i)
	if s == t:
		list2.append(int(num1))
		c += 1
		s = 0
	else:
		s = 0
print(c)
for y in sorted(list2):
	print(y)


def sum(x):
	l = str(x)
	i = 0
	for j in range(len(l)):
		i = i + int(l[j])
	return i
x = int(input(''))
q = 10 * len(str(x))
q = max(x - q, 0)
l = []
for i in range(q, x):
	if i + sum(i) == x:
		l.append(i)
print(len(l))
for i in range(len(l)):
	print(l[i])


import sys
from math import ceil

def solve(n):
	values = []
	for x in range(n, 0, -1):
		if x + sum(map(int, str(x))) == n:
			values.append(x)
		elif x + sum(map(int, str(x))) < n and str(x)[-1] == '9':
			break
	if not len(values):
		print(0)
		return
	print(len(values))
	for x in sorted(values):
		print(x)

def main():
	for x in [x.split() for x in sys.stdin]:
		solve(int(x[0]))
main()


x = int(input())
l = []
for i in range(1, 101):
	if i >= x:
		break
	t = x - i
	s = t
	while t:
		r = t % 10
		t = t // 10
		s = s + r
	if s == x:
		l.append(x - i)
print(len(l))
l.sort()
for i in l:
	print(i)


n = int(input())
ans = []
for i in range(max(1, n - len(str(n)) * 9), n):
	if i + sum(map(int, str(i))) == n:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = is1()
res = []
for i in range(len(n) * 9 + 1):
	ans = 0
	if int(n) - i > 0:
		for j in str(int(n) - i):
			ans += int(j)
		if ans == i:
			res.append(int(n) - i)
print(len(res))
for i in sorted(res):
	print(i)


n = int(input())

def digit_sum(x):
	if x < 0:
		return 0
	res = 0
	while x:
		res += x % 10
		x = x // 10
	return res
res = []
for i in range(200):
	m = n - i
	if digit_sum(m) == i:
		res.append(m)
print(len(res))
while res:
	print(res.pop())


def getSum(num):
	s = 0
	for char in str(num):
		s += int(char)
	return s + num
n = int(input())
p = []
for i in range(n, n - 9 * len(str(n)) - 1, -1):
	if i < 0:
		break
	if getSum(i) == n:
		p.append(i)
print(len(p))
p.sort()
for n in p:
	print(n)


ans = list()

def digit_sum(n):
	num_str = str(n)
	sum = 0
	for i in range(0, len(num_str)):
		sum += int(num_str[i])
	return sum
n = int(input())
for i in range(1, n + 1):
	if i > 100:
		break
	num = n - i
	ss = digit_sum(str(num))
	if ss == i:
		ans.append(int(num))
ans.sort()
print(len(ans))
for i in range(len(ans)):
	print(ans[i])


n = int(input())
ans = 0
ansa = []
for i in range(1, min(len(str(n)) * 9 + 1, n + 1)):
	if i == sum(list(map(int, list(str(n - i))))):
		ans += 1
		ansa.append(n - i)
print(ans)
ansa.sort()
for i in ansa:
	print(i)


n = int(input())

def sum_digits(m):
	s = 0
	while m > 0:
		s += m % 10
		m //= 10
	return s
l = []
k = 0
for x in range(max(n - 81, 0), n):
	s = x + sum_digits(x)
	if s == n:
		l.append(x)
		k += 1
print(k)
for e in l:
	print(e)


n = int(input())
ans = []
for i in range(0, 90):
	x = n - i
	if x <= 0:
		continue
	ds = 0
	s = str(x)
	for c in s:
		ds += ord(c) - ord('0')
	if ds == i:
		ans.append(x)
ans = sorted(ans)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
a = []
if n <= 100:
	for i in range(1, n):
		x = str(i)
		x = list(map(int, x))
		if i + sum(x) == n:
			a.append(i)
else:
	for i in range(n - 99, n):
		x = str(i)
		x = list(map(int, x))
		if i + sum(x) == n:
			a.append(i)
print(len(a))
print(*a)


n = int(input())
digits = len(str(n))
res = []
for i in range(max(n - digits * 9, 0), n):
	sm = 0
	for j in str(i):
		sm += int(j)
	sm += i
	if sm == n:
		res.append(i)
print(len(res))
for i in res:
	print(i)


n = int(input())
mas = []
for i in range(n - 10 * len(str(n)), n):
	if i < 1:
		continue
	if i + sum(list(map(int, str(i)))) == n:
		mas.append(i)
if len(mas) == 0:
	print(0)
else:
	print(len(mas))
	print(' '.join(list(map(str, mas))))


def cw(n):
	a = []
	for i in range(max(n - 100, 1), n):
		v = str(i)
		w = i
		for j in v:
			w += int(j)
		if w == n:
			a.append(i)
	if len(a) > 0:
		print(len(a))
		for i in a:
			print(i)
	else:
		print(0)
v = input()
cw(int(v))


from itertools import permutations
from sys import stdin, stdout

def sod(x):
	num_sum = 0
	x = str(x)
	for i in x:
		num_sum += int(i)
	return num_sum
n = int(input())
ans = []
for x in range(0, 101):
	if n - x >= 0 and x == sod(n - x):
		ans.append(n - x)
print(len(ans))
ans.sort()
for a in ans:
	print(a)


n = int(input())
ans = []
for i in range(max(0, n - 100), n):
	s = 0
	for j in range(9):
		s += i // 10 ** j % 10
	if n == i + s:
		ans.append(i)
print(len(ans))
for i in range(len(ans)):
	print(ans[i])


n = int(input())
ans = 0
l = []
for m in range(max(n - 82, 1), n):
	if m + sum(map(int, [d for d in str(m)])) == n:
		ans += 1
		l.append(m)
print(ans)
for d in l:
	print(d)


def summ(n):
	s = 0
	for i in str(n):
		s += int(i)
	return s
(n, count, a) = (int(input()), 0, [])
for i in range(max(1, n - 81), n):
	if summ(i) + i == n:
		count += 1
		a.append(i)
print(count)
for i in a:
	print(i)


a = int(input())
l = []
for i in range(1, 81):
	s = 0
	for j in range(len(str(abs(a - i)))):
		s = s + int(str(abs(a - i))[j])
	if s == i:
		l.append(a - i)
l.sort()
print(len(l))
for i in range(len(l)):
	print(l[i])


import math

def digitsum(x):
	ret = 0
	while x:
		ret += x % 10
		x //= 10
	return ret
n = int(input())
x = n
ans = []
while n - x < 500 and x >= 0:
	val = x + digitsum(x)
	if val == n:
		ans.append(x)
	x -= 1
print(len(ans))
for i in reversed(ans):
	print(i)


while True:
	try:
		n = input()
		arr = []
		n = int(n)
		start = int(n - 100)
		if start <= 0:
			start = int(1)
		counter = int(0)
		for i in range(start, n):
			tp = int(i)
			ans = int(0)
			while tp != 0:
				ans += int(tp % 10)
				tp /= 10
			ans += int(i)
			if ans == n:
				counter += 1
				arr.append(int(i))
		if counter == 0:
			print(0)
		else:
			print(counter)
			for i in range(0, counter):
				print(arr[i])
	except:
		break


n = int(input())
ans = []
for s in range(1, min(n + 1, 99)):
	x = n - s
	sm = sum((int(i) for i in str(x)))
	if sm == s:
		ans.append(x)
print(len(ans))
for i in sorted(ans):
	print(i, end=' ')


def s(st):
	return sum(list(map(int, str(st))))
n = int(input())
ans = []
for i in range(1, 82):
	if i >= n:
		break
	elif s(n - i) == i:
		ans.append(n - i)
ans.sort()
print(len(ans))
for i in ans:
	print(i)


n = int(input())
num = n
count = 0
while num > 0:
	count += 1
	num = num // 10
a = []
for i in range(n, n - count * 10, -1):
	temp = i
	ans = temp
	while temp > 0:
		ans += temp % 10
		temp = temp // 10
	if ans == n:
		a.append(i)
print(len(a))
a.sort()
for x in a:
	print(x)


n = int(input())
m = str(n)
g = len(m)
l = [int(m[0]) - 1] + [9] * (g - 1)
h = 0
less = 0
while h < len(l):
	less = less + l[h]
	h = h + 1
a = n - less
r = []
i = 0
while a < n:
	j = 0
	s = str(a)
	c = a
	while j < len(s):
		c = c + int(s[j])
		j = j + 1
	if c == n:
		i += 1
		r = r + [a]
	a = a + 1
if i == 0:
	print(0)
else:
	print(i)
	j = 0
	while j < len(r):
		print(r[j])
		j = j + 1


n = int(input())
ans = set()
f = lambda x: sum((int(i) for i in str(x)))
for i in range(max(0, n - 1000), n + 1):
	if i + f(i) == n:
		ans.add(i)
print(len(ans))
for i in sorted(ans):
	print(i)


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

def is_answer(num, n):
	sum = num
	for c in str(num):
		sum += int(c)
	return sum == n
for i in range(max(n - 100, 0), n):
	if is_answer(i, n):
		answers.append(i)
print(len(answers))
for answer in answers:
	print(answer)


n = int(input())

def digits(v):
	s = 0
	while v > 0:
		s += v % 10
		v //= 10
	return s
a = []
for x in range(max(0, n - 81), n):
	if x + digits(x) == n:
		a.append(x)
print(len(a))
if len(a) > 0:
	print(' '.join(map(str, a)))


n = int(input())
k = 0
A = []

def su1(x):
	s1 = 0
	while x > 0:
		s1 += x % 10
		x //= 10
	return s1
for x in range(1, 100):
	f = n - x
	if su1(f) == x:
		k += 1
		A.append(f)
if k == 0:
	print(0)
else:
	print(k)
	A.sort()
	for i in range(k):
		print(A[i])


n = input()
ans = []

def c(s):
	res = s
	s = str(s)
	for i in s:
		res += int(i)
	return res
lb = int(n) - (9 * len(n) - 1)
if lb < 1:
	lb = 1
ans = 0
d = []
for i in range(lb, int(n)):
	if c(i) == int(n):
		d.append(i)
		ans += 1
print(ans)
for i in d:
	print(i)


import sys
import math
n = int(input())
ans = []
for i in range(min(n, 100)):
	p = n - i
	s = p
	while p > 0:
		s += p % 10
		p = p // 10
	if s == n:
		ans.append(n - i)
print(len(ans))
ans.sort()
for x in ans:
	print(x)


from sys import stdin, stdout
n = int(stdin.readline())
ans = []
for i in range(max(1, n - 1000), n + 1000):
	if sum(map(int, list(str(i)))) + i == n:
		ans.append(i)
stdout.write(str(len(ans)) + '\n')
ans.sort()
stdout.write('\n'.join(list(map(str, ans))))


n = int(input())
k = 0
d = []
for i in range(90):
	x = n - i
	t = 0
	while x > 0:
		t += x % 10
		x //= 10
	if t == i:
		k += 1
		d.append(n - i)
print(k)
i = k - 1
while i >= 0:
	print(d[i], end=' ')
	i -= 1


n = int(input())

def som(i):
	s = str(i)
	v = 0
	for j in range(len(s)):
		v = v + int(s[j])
	return v
l = []
for i in range(max(1, n - 100), n):
	if som(i) + i == n:
		l.append(i)
print(len(l))
for i in l:
	print(i)


def f(n):
	return sum((int(i) for i in str(n)))
n = int(input())
upper = 9 * 9
(cnt, ans) = (0, [])
for x in range(n - upper, n):
	if 0 <= x and x + f(x) == n:
		cnt += 1
		ans.append(x)
print(cnt)
for i in ans:
	print(i)


n = int(input())
l = []
if n >= 100:
	for i in range(n - 100, n + 1):
		k = 0
		for j in range(len(str(i))):
			k += int(str(i)[j])
		if k + i == n:
			l.append(i)
else:
	for i in range(1, n + 1):
		if i < 10:
			if 2 * i == n:
				l.append(i)
		elif i + int(str(i)[0]) + int(str(i)[1]) == n:
			l.append(i)
print(len(l))
for i in l:
	print(i)


n = int(input())
(result, res) = (0, [])
for i in range(1, min(90, n)):
	(x, summa) = (n - i, 0)
	for (j, y) in enumerate(str(x)):
		summa += int(y)
	if x + summa == n:
		result += 1
		res.append(x)
print(result)
res.reverse()
for (i, x) in enumerate(res):
	print(x)


n = int(input())
t = 0
i = 1
l = []
while i < 100 and i < n:
	s = n - i
	k = list(str(s))
	k = map(int, k)
	if sum(k) == i:
		t = t + 1
		l.append(s)
	i = i + 1
print(t)
l.sort()
print(*l, sep='\n')


n = int(input())
a = []
for i in range(min(n, 82), -1, -1):
	c = n - i
	c += sum([int(j) for j in str(c)])
	if c == n:
		a.append(n - i)
print(len(a))
for i in a:
	print(i)