You are given a string $$$s$$$ consisting of lowercase Latin letters. Let the length of $$$s$$$ be $$$|s|$$$. You may perform several operations on this string.In one operation, you can choose some index $$$i$$$ and remove the $$$i$$$-th character of $$$s$$$ ($$$s_i$$$) if at least one of its adjacent characters is the previous letter in the Latin alphabet for $$$s_i$$$. For example, the previous letter for b is a, the previous letter for s is r, the letter a has no previous letters. Note that after each removal the length of the string decreases by one. So, the index $$$i$$$ should satisfy the condition $$$1 \le i \le |s|$$$ during each operation.For the character $$$s_i$$$ adjacent characters are $$$s_{i-1}$$$ and $$$s_{i+1}$$$. The first and the last characters of $$$s$$$ both have only one adjacent character (unless $$$|s| = 1$$$).Consider the following example. Let $$$s=$$$ bacabcab.  During the first move, you can remove the first character $$$s_1=$$$ b because $$$s_2=$$$ a. Then the string becomes $$$s=$$$ acabcab.  During the second move, you can remove the fifth character $$$s_5=$$$ c because $$$s_4=$$$ b. Then the string becomes $$$s=$$$ acabab.  During the third move, you can remove the sixth character $$$s_6=$$$'b' because $$$s_5=$$$ a. Then the string becomes $$$s=$$$ acaba.  During the fourth move, the only character you can remove is $$$s_4=$$$ b, because $$$s_3=$$$ a (or $$$s_5=$$$ a). The string becomes $$$s=$$$ acaa and you cannot do anything with it. Your task is to find the maximum possible number of characters you can remove if you choose the sequence of operations optimally.

The only line of the input contains one integer $$$|s|$$$ ($$$1 \le |s| \le 100$$$) — the length of $$$s$$$. The second line of the input contains one string $$$s$$$ consisting of $$$|s|$$$ lowercase Latin letters.

Print one integer — the maximum possible number of characters you can remove if you choose the sequence of moves optimally.

NoteThe first example is described in the problem statement. Note that the sequence of moves provided in the statement is not the only, but it can be shown that the maximum possible answer to this test is $$$4$$$.In the second example, you can remove all but one character of $$$s$$$. The only possible answer follows.  During the first move, remove the third character $$$s_3=$$$ d, $$$s$$$ becomes bca.  During the second move, remove the second character $$$s_2=$$$ c, $$$s$$$ becomes ba.  And during the third move, remove the first character $$$s_1=$$$ b, $$$s$$$ becomes a.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            TextReader sr = Console.In;
            //StreamReader sr = new StreamReader("3.txt");
            int n = Convert.ToInt32(sr.ReadLine());
            string ss = sr.ReadLine();
            List<char> str = new List<char>();
            for (int ii = 0; ii < n; ii++)
            {
                str.Add(ss[ii]);
            }
            int i = 0;
            int res = 0;
            char b = 'z';
            while (true)
            {
                if (i == str.Count())
                {
                    i = 0;
                    b--;
                    if (b < 'a') break;
                    else continue;
                }
                if (str[i] == b)
                {
                    if ((i > 0) && (str[i - 1] == (b - 1)))
                    {
                        str.RemoveAt(i);
                        res++;
                    }
                    else if ((i < str.Count - 1) && (str[i + 1] == (b - 1)))
                    {
                        str.RemoveAt(i);
                        res++;
                        if (i > 0) i--;
                    }
                    else
                    {
                        i++;
                    }
                }
                else
                {
                    i++;
                }
            }
            Console.WriteLine(res.ToString());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {

        static void PrintAnswer(int s, List<char> text)
        {
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                int biggerIndex = 0;

                // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());

                for (int i = biggerIndex; i < text.Count; i++)
                {
                    if (i == 0)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                            if (((int)text[i]) - ((int)text[i + 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else if (i == text.Count - 1)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1 && i > 0)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            if (text.Count > 2 && i < text.Count-2)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                        }
                    }
                }
                if (!errorFound)
                    Finished = true;
            }
            Console.WriteLine(c);
        }
        static void Main(string[] args)
        {
            int s = Int32.Parse(Console.ReadLine());
            List<char> text = Console.ReadLine().Select(x => x).ToList();

            // PrintAnswer(s,text);
            FindMaxChars(s, text);
        }

        static void FindMaxChars(int s, List<char> text)
        {
            if (s == 1) { Console.WriteLine(0); return; }
            int c = 0;

            bool Finished = false;

            while (!Finished)
            {
            ResetLoop:
                if (text.Count == 1) goto EndLoop;
                List<char> bigChars = text.Distinct().OrderByDescending(x => (int)x).ToList();
                for (int j = 0; j < bigChars.Count; j++)
                {
                    if (bigChars[j] == 'a') continue;
                    for (int i = 0; i < text.Count; i++)
                    {
                        if (text[i] == bigChars[j])
                        {
                            // check for previous
                            if (i > 0)
                            {
                                if ((int)text[i] - (int)text[i - 1] == 1)
                                {
                                    text.RemoveAt(i); c++;  goto ResetLoop;
                                }
                            }
                            // check for next
                            if (i < text.Count-1)
                            {
                                if ((int)text[i] - (int)text[i + 1] == 1)
                                {
                                    text.RemoveAt(i); c++; goto ResetLoop;
                                }
                            }
                        }
                    }
                }

                EndLoop:
                Finished = true;
            }

            Console.WriteLine(c);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        string s = sc.Next();

        // n文字 sがある

        // s_iに隣接する文字がs_iより1つ小さいならs_iを消せる

        // 消せる 最大

        var ar = s.ToCharArray();

        for (char c = 'z'; c >= 'b'; c--)
        {
            var stack = new Stack<char>();
            foreach (char ch in ar)
            {
                if (ch == c && stack.Count > 0 && stack.Peek() == c - 1)
                {
                    continue;
                }
                else if (ch == c - 1)
                {
                    while (stack.Count > 0 && stack.Peek() == c)
                    {
                        stack.Pop();
                    }
                    stack.Push(ch);
                }
                else
                {
                    stack.Push(ch);
                }
            }

            ar = new char[stack.Count];
            for (int i = ar.Length - 1; i >= 0; i--)
            {
                ar[i] = stack.Pop();
            }
        }

        Console.WriteLine(n - ar.Length);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
			{
				Console.WriteLine(0);
				return;
			}
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while ((r<n)&&(x[r] == '?' || x[r] == y))
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }

using System.Collections.Generic;
using System;

class _1321C
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		List<char> list = new List<char>(s.ToCharArray());
		int cnt = 0;
		const int LetterLen = 26;
		for (int i = LetterLen - 1; i >= 1; --i)
		{
			char cur = (char)('a' + i);
			char prev = (char)(cur - 1);
			for (int j = 0; j < list.Count; ++j)
			{
				if (j >= 1)
				{
					if (list[j] == cur && list[j - 1] == prev)
					{
						list.RemoveAt(j);
						j = 0;
						++cnt;
						continue;
					}
					if (list[j] == prev && list[j - 1] == cur)
					{
						list.RemoveAt(j - 1);
						j = 0;
						++cnt;
						continue;
					}
				}
			}
		}
		Console.WriteLine(cnt);
	}
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void test123()
    {

        string str = Console.ReadLine();
        var str1 = str.Split(' ');

        UInt64 n = Convert.ToUInt64(str1[0]);
        UInt64 m = Convert.ToUInt64(str1[1]);
        UInt64 a = Convert.ToUInt64(str1[2]);

        UInt64 a1 = n / a + (UInt64) (n % a > 0 ? 1 : 0);
        UInt64 a2 = m / a + (UInt64) (m % a > 0 ? 1 : 0);

        Console.WriteLine(a1 * a2);

    }

    static (char, List<int>) MaxSymbolLowerThan(string str, int maxValue)
    {
        int maxFindedValue = 0;
        int indexOfMax = 0;
        List<int> indexes = new List<int>();

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] > maxFindedValue && (int) str[i] < maxValue) // проверить как он кастуется к инту
            {
                indexes.Clear();
                indexes.Add(i);
                maxFindedValue = (int) (str[i]); //Char.GetNumericValue
            }
            else if (maxFindedValue == str[i])
            {
                indexes.Add(i);
            }
        }

        return ((char)maxFindedValue, indexes);
    }

    static void test3234234()
    {
        int n = Convert.ToInt32(Console.ReadLine());

        int steps = 0;

        string str = Console.ReadLine();

        //int count = 0;

        int indexOfMax = 0; // нужен ли ?

        List<int> indexesOfMax;

        char maxSymbol = ' ';
        (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, 9999);

        //var indexesOfMaxBuffer = indexesOfMax.GetRange(0, n);
        //int[] indexEsOfMaxValue = str.Where(s=>s==maxSymbol).Select()

        int minValue = str.Min();

        bool ValueWasFinded = false;
        bool LastSymbol = false;
        int countOfIndexes = 123;
        //while (true)
        //{
        //if (n == 1) // лучше через n
        //{
        //    Console.WriteLine(steps);
        //    return;
        //}

        //if (LastSymbol && minValue == (int) maxSymbol) // еще один флаг ?  проверка недоделана !!!
        //{
        //    Console.WriteLine(steps);
        //    return;
        //}

        int j = 0; // индекс в IndexesOfMax
        while (true)
        {
            if (countOfIndexes == 0)
            {
                Console.WriteLine(steps);
                return;
            }

            if (j < indexesOfMax.Count && indexesOfMax[j] != 0 && str[indexesOfMax[j] - 1] == (int) str[indexesOfMax[j]] - 1 )
            {
                ValueWasFinded = true;
                str = str.Remove(indexesOfMax[j], 1);
                steps++;
                n--;
                indexesOfMax.RemoveAt(j);
                for (var z = j ; z < indexesOfMax.Count; z++)
                    indexesOfMax[z]--;

            }

            else if (j < indexesOfMax.Count && indexesOfMax[j] != n - 1 && str[indexesOfMax[j] + 1] == (int) (str[indexesOfMax[j]]) - 1)
            {
                ValueWasFinded = true;
                str = str.Remove(indexesOfMax[j], 1);

                steps++;
                n--;
                indexesOfMax.RemoveAt(j);
                for (var z = j ; z<indexesOfMax.Count; z++)
                    indexesOfMax[z]--;

            }

            else
            {
                if (j >= indexesOfMax.Count - 1)
                {
                    if (!ValueWasFinded)
                    {
                        (maxSymbol, indexesOfMax) = MaxSymbolLowerThan(str, (int) maxSymbol);
                        countOfIndexes = indexesOfMax.Count;
                    }
                    else
                        ValueWasFinded = false;
                    j = 0;
                }
                else
                    j++;
            }
        }
    }

    static void Main(string[] args)
    {

        test3234234();
    }
}

using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;
using System.Numerics;

static class SolutionTemplate
{
    static long modPow(long v, long p, long mod)
    {
        if (p == 0)
            return 1;
        if (p == 1)
            return v;

        long add = 1;
        while (p > 1)
        {
            if (p % 2 == 1)
            {
                add *= v;
                add %= mod;
            }
            v = (v * v) % mod;
            p = p / 2;
        }
        return (v * add) % mod;
    }

    public static List<T> GetOrAddNew<K, T>(this Dictionary<K, List<T>> dic, K key)
    {
        if (dic == null) throw new ArgumentNullException();

        return (dic[key] = dic.ContainsKey(key) ? dic[key] : new List<T>());
    }

    public static V GetValueOrDefault<K, V>(this Dictionary<K, V> dic, K key)
    {
        if (dic == null) throw new ArgumentNullException();
        if (dic.ContainsKey(key))
            return dic[key];
        return default(V);

    }

    public static void AddOrSet<K>(this Dictionary<K, long> dic, K key, long add)
    {
        if (dic == null) throw new ArgumentNullException();

        dic[key] = dic.GetValueOrDefault(key) + add;
    }

    public static void AddOrSet<K>(this Dictionary<K, int> dic, K key, int add)
    {
        if (dic == null) throw new ArgumentNullException();

        dic[key] = dic.GetValueOrDefault(key) + add;
    }

    public static void AddOrSetRemove<K>(this Dictionary<K, long> dic, K key, long add)
    {
        if (dic == null) throw new ArgumentNullException();

        dic[key] = dic.GetValueOrDefault(key) + add;

        if (dic[key] == 0)
        {
            dic.Remove(key);
        }
    }

    public static void AddOrSetRemove<K>(this Dictionary<K, int> dic, K key, int add)
    {
        if (dic == null) throw new ArgumentNullException();

        dic[key] = dic.GetValueOrDefault(key) + add;

        if (dic[key] == 0)
        {
            dic.Remove(key);
        }
    }

    public static void RemoveKeyWhen<K, V>(this Dictionary<K, V> dic, K key, V val)
    {
        if (dic == null) throw new ArgumentNullException();

        if (dic.ContainsKey(key) && object.Equals(dic[key], val))
        {
            dic.Remove(key);
        }
    }

    public static void RemoveAllWhen<K, V>(this Dictionary<K, V> dic, V val)
    {
        if (dic == null) throw new ArgumentNullException();

        var keys = dic.Keys.ToList();
        foreach (var item in keys)
        {
            if (object.Equals(dic[item], val))
            {
                dic.Remove(item);
            }
        }
    }

    public static Dictionary<T, int> ToCountDictionary<T>(this IEnumerable<T> enm)
    {
        return enm.GroupBy(el => el).ToDictionary(k => k.Key, val => val.Count());
    }

    public static Dictionary<T, int> ToIndexDictionary<T>(this IEnumerable<T> enm)
    {
        return enm.Select((el, i) => new { val = el, index = i }).ToDictionary(key => key.val, val => val.index);
    }

    public static Dictionary<T, List<int>> ToIndiciesDictionary<T>(this IEnumerable<T> enm)
    {
        return enm.Select((el, i) => new { val = el, index = i }).GroupBy(el => el.val).
            ToDictionary(key => key.Key, val => val.Select(v => v.index).ToList());
    }

    static long readLong()
    {
        return long.Parse(Console.ReadLine().Trim());
    }

    static int readInt()
    {
        return int.Parse(Console.ReadLine().Trim());
    }

    static double readDouble()
    {
        return double.Parse(Console.ReadLine().Trim());
    }

    static long[] readLongs()
    {
        return Array.ConvertAll(Console.ReadLine().Trim().Split(), long.Parse);
    }

    static int[] readInts(int add = 0)
    {
        return Array.ConvertAll(Console.ReadLine().Trim().Split(), el => int.Parse(el) + add);
    }

    static string[] readStrings()
    {
        return Console.ReadLine().Trim().Split();
    }

    static string readString()
    {
        return Console.ReadLine().Trim();
    }

    public static int readInt(this StreamReader str)
    {
        if (str == null) throw new ArgumentNullException();
        return int.Parse(str.ReadLine().Trim());
    }

    public static int[] readInts(this StreamReader str)
    {
        if (str == null) throw new ArgumentNullException();
        return Array.ConvertAll(str.ReadLine().Trim().Split(), int.Parse);
    }

    static StringBuilder WriteArray(StringBuilder sb, IEnumerable lst, string delimeter)
    {
        if (lst == null)
            throw new ArgumentNullException(nameof(lst));
        if (sb == null)
            throw new ArgumentNullException(nameof(sb));

        foreach (var el in lst)
        {
            sb.Append(el);
            if (delimeter != null)
                sb.Append(delimeter);
        }
        return sb;
    }

    static StringBuilder WriteObject(StringBuilder sb, object obj, string delimeter)
    {
        if (obj == null)
            throw new ArgumentNullException(nameof(obj));
        if (sb == null)
            throw new ArgumentNullException(nameof(sb));

        sb.Append(obj);
        if (delimeter != null)
            sb.Append(delimeter);
        return sb;
    }

    static void Write2DimArr<T>(this T[,] arr, string delimeter = " ", string delimeter2 = "\n")
    {
        if (arr == null)
            throw new ArgumentNullException(nameof(arr));

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.GetLength(0); i++)
        {
            for (int j = 0; j < arr.GetLength(1); j++)
            {
                WriteObject(sb, arr[i, j], delimeter);
            }
            sb.Append(delimeter2);
        }
        Console.Write(sb.ToString());
    }

    static void Write(this object obj, string delimeter = " ")
    {
        if (obj == null)
            throw new ArgumentNullException(nameof(obj));

        var enm = obj as IEnumerable;
        StringBuilder sb = new StringBuilder();
        if (enm != null)
            WriteArray(sb, enm, delimeter);
        else
        {
            WriteObject(sb, obj, delimeter);
        }
        Console.Write(sb.ToString());
    }
    static void WriteLine(this object obj, string delimeter = " ")
    {
        obj.Write(delimeter);
        Console.WriteLine();
    }
    static void WriteS(params object[] obj)
    {
        obj.Write(" ");
    }
    static void WriteLineS(params object[] obj)
    {
        obj.WriteLine(" ");
    }

    static bool isLess(string cur, string str)
    {
        if (cur.Length > str.Length)
            return false;

        if (cur.Length < str.Length)
            return true;

        for (int i = 0; i < cur.Length; i++)
        {
            var curd = (int)char.GetNumericValue(cur[i]);
            var strd = (int)char.GetNumericValue(str[i]);
            if (curd < strd)
                return true;
            if (curd > strd)
                return false;
        }
        return false;
    }

    static List<long> factorial(long n, long m)
    {
        var ret = new long[n + 1];
        ret[0] = 1;
        for (long i = 1; i < n + 1; i++)
        {
            ret[i] = (ret[i - 1] * i) % m;
        }
        return ret.ToList();

    }

    private static int GetAfter(int c, List<int> lst)
    {
        var l = -1;
        var r = lst.Count;

        while (r - l > 1)
        {
            var cur = (r + l) / 2;

            if (lst[cur] <= c)
            {
                l = cur;
            }
            else
            {
                r = cur;
            }
        }
        return r;

    }

    private static string GoogleString(int t, string add)
    {
        return string.Format("Case #{0}: {1}", t, add);
    }

    private static int getPow(long v)
    {
        var cnt = 0;
        while (v > 0)
        {
            cnt++;
            v = v >> 1;
        }
        return cnt;
    }

    private static int getSteps(long v, long target)
    {
        if (target > v)
            throw new Exception();
        var cnt = 0;
        while (v > target)
        {
            cnt++;
            v = v >> 1;
        }
        return cnt;
    }

    static int findLcaLen(int[,] sparse, int[] levels, int v1, int v2, int m)
    {
        if (levels[v1] < levels[v2])
        {
            var tmp = v1;
            v1 = v2;
            v2 = tmp;
        }
        int len = 0;
        for (int i = m; i >= 0; i--)
        {
            if (levels[sparse[v1, i]] >= levels[v2])
            {
                len += (1 << i);
                v1 = sparse[v1, i];
            }
        }
        if (v1 == v2) return len;

        for (int i = m; i >= 0; i--)
        {
            if (sparse[v1, i] != sparse[v2, i])
            {
                v1 = sparse[v1, i];
                v2 = sparse[v2, i];
                len += (1 << (i + 1));
            }
        }
        return len + 2;

    }

    private static int greater(List<int> lst, int vl)
    {
        int l = -1;
        int r = lst.Count;
        while (r - l > 1)
        {
            var cur = (r + l) / 2;
            if (lst[cur] <= vl)
            {
                l = cur;
            }
            else
            {
                r = cur;
            }
        }
        return r;
    }

    public class Heap<T> where T : IComparable<T>
    {
        List<T> arr;
        bool isMax;

        public Heap(int n, bool isMax = true)
        {
            this.isMax = isMax;
            arr = new List<T>(n);
        }

        public Heap(bool isMax = true)
        {
            this.isMax = isMax;
            arr = new List<T>();
        }

        private void Heapify(int i)
        {
            var ch1 = 2 * i + 1;
            var ch2 = 2 * i + 2;

            if (isMax)
            {
                if (ch2 < arr.Count)
                {
                    if (arr[ch2].CompareTo(arr[ch1]) < 0)
                    {
                        if (arr[i].CompareTo(arr[ch1]) < 0)
                        {
                            Swap(i, ch1);
                            Heapify(ch1);
                        }
                    }
                    else // arr[ch2] <= arr[ch1]
                    {
                        if (arr[i].CompareTo(arr[ch2]) < 0)
                        {
                            Swap(i, ch2);
                            Heapify(ch2);
                        }
                    }
                }
                else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) > 0)
                {
                    Swap(i, ch1);
                    Heapify(ch1);
                }
            }
            else
            {
                if (ch2 < arr.Count)
                {
                    if (arr[ch2].CompareTo(arr[ch1]) > 0)
                    {
                        if (arr[i].CompareTo(arr[ch1]) > 0)
                        {
                            Swap(i, ch1);
                            Heapify(ch1);
                        }
                    }
                    else // arr[ch2] <= arr[ch1]
                    {
                        if (arr[i].CompareTo(arr[ch2]) > 0)
                        {
                            Swap(i, ch2);
                            Heapify(ch2);
                        }
                    }
                }
                else if (ch1 < arr.Count && arr[ch1].CompareTo(arr[i]) < 0)
                {
                    Swap(i, ch1);
                    Heapify(ch1);
                }
            }
        }

        public T Pop()
        {
            if (arr.Count < 1)
                throw new Exception("Extracting min from empty heap");
            var min = arr[0];
            arr[0] = arr[arr.Count - 1];
            arr.RemoveAt(arr.Count - 1);
            Heapify(0);
            return min;
        }

        public T Peek()
        {
            if (arr.Count < 1)
                throw new Exception("Extracting min from empty heap");
            var min = arr[0];
            return min;
        }

        public int Count()
        {
            return arr.Count;
        }

        public void Add(T val)
        {
            if (val == null)
                throw new ArgumentNullException();
            arr.Add(val);
            Up(arr.Count - 1);
        }

        private void Up(int i)
        {
            while (i > 0)
            {
                var next = (i - 1) / 2;
                if (isMax)
                {
                    if (arr[next].CompareTo(arr[i]) < 0)
                    {
                        Swap(i, next);
                        i = next;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    if (arr[next].CompareTo(arr[i]) > 0)
                    {
                        Swap(i, next);
                        i = next;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }

        private void Swap(int i, int j)
        {
            var tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
    }

    class Item : IComparable<Item>
    {
        public int Id;
        public int Value;
        public long Cnt;

        public int CompareTo(Item other)
        {
            return this.Value - other.Value;
        }

        public int CompareTo(object other)
        {
            return CompareTo((int)other);
        }

    }

    private static void Main(string[] args)
    {
        var n = readInt();
        var str = readString();

        int cnt = 0;
        var lst = str.Distinct().OrderByDescending(el => el).ToList();
        for (int i = 0; i < lst.Count; i++)
        {
            var el = lst[i];
            var dic = str.ToIndiciesDictionary();
            HashSet<int> toDelete = new HashSet<int>();
            foreach (var ind in dic[el])
            {
                if (ind > 0 && str[ind] - str[ind - 1] == 1)
                {
                    toDelete.Add(ind);
                }
                else if (ind < str.Length - 1 && str[ind] - str[ind + 1] == 1)
                {
                    toDelete.Add(ind);

                }

            }
            if (toDelete.Count > 0)
            {
                if (dic[el].Count > toDelete.Count)
                    i --;
                cnt += toDelete.Count;
                str = string.Join("", str.Where((el2, index) => !toDelete.Contains(index)));
            }
        }
        cnt.WriteLine();
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {

        static void PrintAnswer(int s, List<char> text)
        {
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                int biggerIndex = 0;

                // biggerIndex = text.IndexOf(text.OrderByDescending(x => (int)(x)).First());

                for (int i = biggerIndex; i < text.Count; i++)
                {
                    if (i == 0)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                            if (((int)text[i]) - ((int)text[i + 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else if (i == text.Count - 1)
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1)
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                            {
                                c++; text.RemoveAt(i); errorFound = true; break;
                            }
                        }
                    }
                    else
                    {
                        if (text[i] == 'a')
                        {
                            continue;
                        }
                        else
                        {
                            if (text.Count > 1 && i > 0)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            if (text.Count > 2 && i < text.Count-2)
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                        }
                    }
                }
                if (!errorFound)
                    Finished = true;
            }
            Console.WriteLine(c);
        }
        static void Main(string[] args)
        {
            int s = Int32.Parse(Console.ReadLine());
            List<char> text = Console.ReadLine().Select(x => x).ToList();

            // PrintAnswer(s,text);
            FindMaxChars(s, text);
        }

        static void FindMaxChars(int s, List<char> text)
        {
            if (s == 1) { Console.WriteLine(0); return; }
            bool Finished = false; bool errorFound = false;
            int c = 0;
            while (!Finished)
            {
                errorFound = false;
                List<char> bigChars = text.OrderByDescending(x => (int)x).Distinct().Where(x => x != 'a').ToList();

                while (bigChars.Count > 0)
                {
                    int bigCharIndex = text.IndexOf(bigChars.First());
                    for (int i = 0; i < text.Count; i++)
                    {
                        if (text[i] == bigChars.First())
                        {
                            if (text.Count == 1) { Finished = true; bigChars = new List<char>(); break; }
                            if (i == 0)
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else if (i == text.Count - 1)
                            {
                                if (((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                            else
                            {
                                if (((int)text[i]) - ((int)text[i + 1]) == 1 || ((int)text[i]) - ((int)text[i - 1]) == 1)
                                {
                                    c++; text.RemoveAt(i); errorFound = true; break;
                                }
                            }
                        }
                    }
                    if (bigChars.Count > 0)
                    bigChars.RemoveAt(0);
                }

                if (!errorFound) Finished = true;
            }
            Console.WriteLine(c);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;

class Test
{
    class a
    {
        public char key;
        public int value;
    }
    // Driver code
    public static void Main()
    {

        //// var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        //var t = input[0];
        //while (t > 0)
        {

            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];

            var x = Console.ReadLine().ToCharArray();
			if (x.Length <= 1)
				return ;
			int s = 0;
			for (int i = 25; i > 0; i--)
			{
				char y = (char)(i + 'a'), z = (char)(i - 1 + 'a');
				for (int j = 0; j < n; j++)
				{
					if (x[j] == y)
					{
						int l = j - 1, r = j + 1;
						while (l>=0&&(x[l] == '?' || x[l] == y))
						{
							l--;
						}
						if (l >= 0)
						{
							if (x[l] == z)
							{
								s++;
								x[j] = '?';
								continue;
							}
						}
						while (x[r] == '?' || x[r] == y)
						{
							r++;
						}
						if (r < n)
						{
							if (x[r] == z)
							{
								s++;
								x[j] = '?';
							}
						}
					}
				}
			}

			Console.WriteLine(s);

            }

        }
    }

using System.Collections.Generic;
using System;

class _1321C
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		List<char> list = new List<char>(s.ToCharArray());
		int cnt = 0;
		const int LetterLen = 26;
		for (int i = LetterLen - 1; i >= 1; --i)
		{
			char cur = (char)('a' + i);
			char prev = (char)(cur - 1);
			for (int j = 0; j < list.Count; ++j)
			{
				if (j >= 1)
				{
					if (list[j] == cur && list[j - 1] == prev)
					{
						list.RemoveAt(j);
						j = 0;
						++cnt;
						continue;
					}
				}
				if (j <= list.Count - 2)
				{
					if (list[j] == cur && list[j + 1] == prev)
					{
						list.RemoveAt(j);
						j = 0;
						++cnt;
						continue;
					}
				}
			}
		}
		Console.WriteLine(cnt);
	}
}


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.

The first line contains integer n (1 ≤ n ≤ 109).

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.

NoteIn 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.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Diagnostics;
namespace contest1
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_442C();
        }

        public static void solve_442C()
        {
            List<int> results = new List<int>();
            int n = Convert.ToInt32(Console.ReadLine());
            int sub = n >= 100 ? 100 : n;

            int start = n - sub;
            int sum = 0;
            while (start <= n)
            {
                int x = start;
                sum = 0;
                while (x > 0)
                {
                    sum += x % 10;
                    x /= 10;
                }
                if (n == start + sum)
                {
                    results.Add(start);
                }
                start++;
            }

            Console.WriteLine(results.Count);
            if (results.Count > 0)
            {
                for (int k = 0; k < results.Count; k++)
                {
                    Console.WriteLine(results[k]);
                }
            }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
using System.Diagnostics;

class Scanner
{
    private readonly char Separator = ' ';
    private int Index = 0;
    private string[] Line = new string[0];
    public string Next()
    {
        if (Index >= Line.Length)
        {
            Line = Console.ReadLine().Split(Separator);
            Index = 0;
        }
        var ret = Line[Index];
        Index++;
        return ret;
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    private long NextLong()
    {
        return long.Parse(Next());
    }
}

class Magatro
{
    private int N;
    private void Scan()
    {
        var sc = new Scanner();
        N = sc.NextInt();
    }

    private int Sum(int n)
    {
        if (n <= 9)
        {
            return n;
        }
        else
        {
            return n % 10 + Sum(n / 10);
        }
    }

    public void Solve()
    {
        Scan();
        var sb = new StringBuilder();
        int cnt = 0;
        for (int i = 100; i >= 0; i--)
        {
            int a = N - i;
            if(Sum(a)==i)
            {
                cnt++;
                sb.AppendLine(a.ToString());
            }
        }
        Console.WriteLine(cnt);
        if(cnt!=0)
        {
            Console.Write(sb.ToString());
        }
    }

    static public void Main()
    {
        new Magatro().Solve();
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ConsoleApp2
{
    class Program
    {

        static void Main(string[] args)
        {
            int n,q=0;
            List<int> l = new List<int>();
            n=Int32.Parse(Console.ReadLine());
            string s="";
            for(int i=n-100;i<=n;i++)
            {
                s = i+"";
                int x = 0;
                for(int j=0;j<s.Length;j++)
                {
                    x += s[j] - '0';
                }
                if(i+x==n)
                {
                    q++;
                    l.Add(i);
                }
            }
            Console.WriteLine(q);
            for(int i=0;i<l.Count;i++)
            {
                Console.Write(l[i]+" ");
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharp
{
    public class _875A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var result = new List<int>();

            for (int i = Math.Max(1, n - 81); i <= n; i++)
            {
                if (i + i.ToString().Sum(d => d - '0') == n)
                {
                    result.Add(i);
                }
            }

            Console.WriteLine(result.Count);

            foreach (int i in result)
            {
                Console.WriteLine(i);
            }
        }
    }
}

using System;

namespace JustForFun
{
    class Program
    {
        static void Main(string[] args)
        {
            int n;
            int digit = 0;
            int[] resultSet = new int[1000];
            int min;
            string line = Console.ReadLine();
            n = Convert.ToInt32(line);
            int tmp = n;
            while (tmp > 9)
            {
                tmp /= 10;
                digit++;
            }
         //   Console.WriteLine(digit);
            min = Math.Max(n - 9 * digit - 9, 1);
            int itr = 0;
            for(int i = 0; i <= n; i++)
            {
                int result = n -i;
                if (result < min)
                    break;
                int tmpt = n - i;
                while(tmpt > 0)
                {
                    result += tmpt % 10;
                    tmpt /= 10;
                }
                //Console.WriteLine(result);
                if(result == n)
                {
                    resultSet[itr++] = n - i;
                }
            }
            Console.WriteLine(itr);
            while (itr > 0)
            {
                Console.WriteLine(resultSet[--itr]);
            }
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Дежурство
{
    class Program
    {
        static int SumOfNums(int x)
        {
            int sum = 0;
            string s = Convert.ToString(x);
            for (int i = 0; i < s.Length; i++)
            {
                sum += Convert.ToInt32(Convert.ToString(s[i]));
            }

            return sum;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int x = 0;

            if (n > 100) x = n - 100;
            else x = 0;
            List<int> nums = new List<int>();
            while (x < n)
            {
                if (x + SumOfNums(x) == n) nums.Add(x);
                x++;
            }

            Console.WriteLine(nums.Count);
            for (int i = 0; i < nums.Count; i++) Console.WriteLine(nums[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class A
   {
      static void Main(string[] args)
      {
        List<int> L = new List<int>();
         int n = int.Parse(Console.ReadLine());
         int to  = (n>100)?n-100:0;
         for(int i=n-1;i>=to;i--){
           if(i + GetSum(i)==n){
              L.Add(i);
           }
         }
         L.Sort();
         Console.WriteLine(L.Count);
         for(int i=0;i<L.Count;i++){
           Console.Write(L[i] + " ");
         }
      }

      static int GetSum(int n){
         int sum = 0;
         string s = n+"";
         for(int i=0;i<s.Length;i++){
           sum += (int)Char.GetNumericValue(s[i]);
         }
         return sum;

      }
   }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nolifer
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> nums = new List<int>();
            int a = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i <= 9 * a.ToString().Length; i++)
            {

                int b = a - i;
                if (b >= 0)
                {
                    string c = b.ToString();
                    for (int j = 0; j < c.Length; j++)
                    {
                        b += Convert.ToInt32(c[j].ToString());

                    }

                    if (b == a)
                    {
                        nums.Add(Convert.ToInt32(c));
                    }
                }
            }
            Console.WriteLine(nums.Count);
            nums.Sort();
            foreach (int w in nums)
            {
                Console.WriteLine(w);
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    public class RandomMath
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
			List<int> Solutions = new List<int>();
			int HowMuch = 0;
			int CheckThis;
			int[] Digits;
			CheckThis = n <= 81 ? 0 : n - 81;
			for (int x = CheckThis; x < n; x++)
			{
				Digits = x.ToString().Select(t => int.Parse(t.ToString())).ToArray();
				int DigitsValue = 0;
				foreach (int dig in Digits)
				{
					DigitsValue += dig;
				}
				if (x + DigitsValue == n)
				{
					HowMuch += 1;
					Solutions.Add(x);

				}
			}
			Console.WriteLine(HowMuch);
			foreach(int Solution in Solutions)
			{
				Console.WriteLine(Solution);
			}
        }
    }
}

using System;
using System.Collections.Generic;

namespace LovNaSataniste
{
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int i, sum, current;
            List<int> xes = new List<int>();
            for (i = n < 81 ? 0 : n - 81; i < n; i++)
            {
                for (current = sum = i; current != 0; current /= 10) sum += current % 10;
                if (n == sum) xes.Add(i);
            }
            Console.WriteLine(xes.Count);
            foreach (int x in xes) Console.WriteLine(x);
        }
    }
}

using System;
using System.Collections.Generic;

namespace Z3
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());
            List<int> output = new List<int>();
            int sum, current, i;

            for (i = num < 81 ? 0 : num - 81; i < num; i++)
            {
                for (current = sum = i; current != 0; current /= 10)
                    sum += current % 10;

                if (num == sum)
                    output.Add(i);
            }

            Console.WriteLine(output.Count);

            for (i = 0; i < output.Count; i++)
                Console.WriteLine(output[i]);
        }
    }
}

using System;
using System.Collections.Generic;

class Program
{
    private static void Main(string[] args)
    {
        int inputNumber = Int32.Parse(Console.ReadLine());
        List<int> findedNumbers = new List<int>();

        int startPosition = inputNumber < 1000000 ? inputNumber / 10 : inputNumber - 100;

        for (int i = startPosition; i < inputNumber; i++)
        {
            char[] parsedInputNumber = i.ToString().ToCharArray();
            int digitSum = 0;

            for (int j = 0; j < parsedInputNumber.Length; j++)
            {
                digitSum += Int32.Parse(parsedInputNumber[j].ToString());
            }

            int currentVariant = i + digitSum;

            if (currentVariant == inputNumber)
            {
                findedNumbers.Add(i);
            }
        }

        Console.WriteLine(findedNumbers.Count);

        if (findedNumbers.Count > 0)
        {
            foreach (var findedNumber in findedNumbers)
            {
                Console.WriteLine(findedNumber);
            }
        }
        Console.ReadLine();
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Classroom_Watch
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            Solve(args);
            writer.Flush();
        }

        private static void Solve(string[] args)
        {
            int n = Next();

            var nn = new List<int>();
            for (int i = n - 1; i >= 1; i--)
            {
                int sum = 0;
                int t = i;
                int count = 0;
                while (t > 0)
                {
                    sum += t%10;
                    t /= 10;
                    count++;
                }
                if (i + sum == n)
                    nn.Add(i);

                if (i + 9*count < n)
                    break;
            }

            nn.Sort();
            writer.WriteLine(nn.Count);
            foreach (int i in nn)
            {
                writer.WriteLine(i);
            }
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;

namespace Testing
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            List<int> values = new List<int>();
            int quantity = 0;
            for(int currentValue = n; currentValue > n - 100 && currentValue > 0; currentValue--)
            {
                int temporaryValue = currentValue;
                int sum = currentValue;
                while(temporaryValue > 0)
                {
                    sum += temporaryValue % 10;
                    temporaryValue /= 10;
                }
                if(sum == n)
                {
                    quantity++;
                    values.Add(currentValue);
                }
            }
            Console.WriteLine(quantity);
            values.Sort();
            foreach(int value in values)
            {
                Console.WriteLine("{0}", value);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt64();
            var max = (long) 1e3;
            var count = 0;
            var answer = new StringBuilder();
            for (var i = n; i <= n + max; i++) {
                var str = i.ToString();
                var sum = i;
                for (var j = 0; j < str.Length; j++) {
                    sum += str[j] - '0';
                }
                if (sum == n) {
                    answer.Append(str + " ");
                    count++;
                }
            }
            for (var i = n - max; i < n; i++) {
                var str = i.ToString();
                var sum = i;
                for (var j = 0; j < str.Length; j++) {
                    sum += str[j] - '0';
                }
                if (sum == n) {
                    answer.Append(str + " ");
                    count++;
                }
            }

            sw.WriteLine(count);
            sw.Write(answer);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace prog1
{
    class Program
    {
        static void Main(string[] args)
        {
            //string a = Console.ReadLine();
            int n = int.Parse(Console.ReadLine());
            string m = n.ToString();
            int current = 0;
            int ans = 0;
            string an = "";
            current = n - (9*m.Length);
            if(current<0)
            {
                current = 0;
            }
            int s = 0;
            int summ = 0;
            int g = 0;
            /*string v = current.ToString();
            for(int i = 0; i<v.Length; i++)
            {
                summ+=int.Parse(v[i].ToString());
            }*/
            while(current<n)
            {

                /*g++;
                if(g>9)
                {
                    g=0;
                    summ-=8;
                    Console.WriteLine(summ);
                }
                else
                {
                    summ++;
                }*/
                summ = 0;
                string v = current.ToString();
            for(int i = 0; i<v.Length; i++)
            {
                summ+=int.Parse(v[i].ToString());
            }
            s=current+summ;

                if(s==n)
                {
                ans++;
                an+=current.ToString();
                an+=" ";
                }
                current++;

            }
            var a1 = an.Split(' ');
            Console.WriteLine(ans);
            for(int i = 0; i<a1.Length-1; i++)
            {
            Console.WriteLine(a1[i]);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var n = s.I();
            int sum = 0;
            for (int i = Math.Max(0,n - 2*s.Length * 10); i < n; i++)
            {
                if (S(i) == n)
                {
                    H.A(i);
                    sum++;
                }
            }
            Console.WriteLine(sum);
            Console.Write(H.Str());
        }
        static int S(int n)
        {
            var t = n;
            var k = n;
            while (k != 0)
            {
                t += k % 10;
                k = k / 10;
            }
            return t;
        }
    }
    static class H
    {
        public static int I(this string str)
        {
            return int.Parse(str);
        }

        public static StringBuilder builder = new StringBuilder();

        public static void A(object a)
        {
            builder.Append(a);
            builder.Append("\n");
        }

        public static string Str()
        {
            return builder.ToString();
        }
        static IEnumerable<int> Read(TextReader rdr)
        {
            int ch;
            bool neg = false;
            int value = 0;
            int count = 0;

            while (-1 != (ch = rdr.Read()))
            {
                if (ch == 9 || ch == 10 || ch == 13 || ch == 32)
                {
                    if (count > 0)
                        yield return neg ? -value : value;
                    count = 0;
                    value = 0;
                    neg = false;
                }
                else if (count == 0 && ch == '-')
                {
                    neg = true;
                }
                else if (ch >= '0' && ch <= '9')
                {
                    count++;
                    value = value * 10 + (ch - '0');
                }
                else
                    throw new InvalidDataException();
            }

            if (count > 0)
                yield return neg ? -value : value;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = new List<int>();

        int maxAdd = 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9 + 9;
        for (var add = maxAdd; add > 0; --add)
        {
            int cand = n - add;
            if (cand <= 0)
                continue;
            if (DigitsSum(cand) != add)
                continue;
            s.Add(cand);
        }
        Console.WriteLine(s.Count);
        if (s.Count > 0)
            Console.WriteLine(string.Join(Environment.NewLine, s));
    }

    static int DigitsSum(int n)
    {
        int sum = 0;
        do
        {
            sum += n % 10;
            n /= 10;
        }
        while (n > 0);
        return sum;
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nolifer
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> nums = new List<string>();
            int a = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i <= 9 * a.ToString().Length; i++)
            {

                int b = a - i;
                if (b >= 0)
                {
                    string c = b.ToString();
                    for (int j = 0; j < c.Length; j++)
                    {
                        b += Convert.ToInt32(c[j].ToString());

                    }

                    if (b == a)
                    {
                        nums.Add(c);
                    }
                }
            }
            Console.WriteLine(nums.Count);
            foreach (string w in nums)
            {
                Console.WriteLine(w);
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Дежурство
{
    class Program
    {
        static int SumOfNums(int x)
        {
            int sum = 0;
            string s = Convert.ToString(x);
            for (int i = 0; i < s.Length; i++)
            {
                sum += Convert.ToInt32(Convert.ToString(s[i]));
            }

            return sum;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int x = 0;

            if (n > 72) x = n - 72;
            else x = 0;
            List<int> nums = new List<int>();
            while (x < n)
            {
                if (x + SumOfNums(x) == n) nums.Add(x);
                x++;
            }

            Console.WriteLine(nums.Count);
            for (int i = 0; i < nums.Count; i++) Console.WriteLine(nums[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Дежурство
{
    class Program
    {
        static int SumOfNums(int x)
        {
            int sum = 0;
            string s = Convert.ToString(x);
            for (int i = 0; i < s.Length; i++)
            {
                sum += Convert.ToInt32(Convert.ToString(s[i]));
            }

            return sum;
        }
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int x = 0;

            if (n > 72) x = n - 72;
            else x = 0;
            while (x < n && x + SumOfNums(x) != n)
            {
                x++;
            }

            if (x + SumOfNums(x) == n)
            {
                Console.WriteLine(1);
                Console.WriteLine(x);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Z3
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());

            if (num < 2)
            {
                Console.WriteLine("0");
                return;
            }
            //else if (num < 10)
            //{
            //    Console.WriteLine("1\n" + (num - 1));
            //    return;
            //}

            List<int> output = new List<int>();
            int res = 1;

            for (int sum = 1, start = 0; res <= num; res++, sum++)
            {
                if (res % 10 == 0)
                {
                    start++;
                    sum = start;
                }

                if (num - res == sum)
                    output.Add(res);
            }

            Console.WriteLine(output.Count);

            for (int i = 0; i < output.Count; i++)
                Console.WriteLine(output[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Z3
{
    class Program
    {
        static bool Match(int n1, int n2)
        {
            if (n1 < 10)
            {
                if (n1 == n2)
                    return true;
                else
                    return false;
            }

            int res = n1;
            int i = 0;
            int k = n1 % 10;

            while (i <= 9)
            {
                res += k;
                i++;
                k = (int)(n1 / Math.Pow(10, i) % 10);
            }

            if (res == n2)
                return true;
            else
                return false;
        }

        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());

            //for (num = 1; num <= 1000000000; num++)
            //{
            //    Console.WriteLine(num);

                if (num < 2)
                {
                    Console.WriteLine("0");
                return;
              //      Console.WriteLine("#########");
              //      Thread.Sleep(800);
             //       continue;
                }

                List<int> output = new List<int>();
                int res = 1;

                while (res <= num)
                {
                    if (Match(res, num))
                        output.Add(res);

                    res++;
                }

                Console.WriteLine(output.Count);

                for (int i = 0; i < output.Count; i++)
                    Console.WriteLine(output[i]);

            //    Thread.Sleep(800);
            //    Console.WriteLine("##########");
            //}
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Z3
{
    class Program
    {
        static bool Match(int n1, int n2)
        {
            if (n1 < 10)
            {
                if (n1 == n2)
                    return true;
                else
                    return false;
            }

            int res = n1;
            int i = 0;
            int k = n1 % 10;

            while (i <= 9)
            {
                res += k;
                i++;
                k = (int)(n1 / Math.Pow(10, i) % 10);
            }

            if (res == n2)
                return true;
            else
                return false;
        }

        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());

            if (num < 10)
            {
                Console.WriteLine("1\n" + num);
                return;
            }

            List<int> output = new List<int>();
            int res = 1;

            while (res <= num)
            {
                if (Match(res, num))
                    output.Add(res);

                res++;
            }

            Console.WriteLine(output.Count);

            for (int i = 0; i < output.Count; i++)
                Console.WriteLine(output[i]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Z3
{
    class Program
    {
        static bool Match(int n1, int n2)
        {
            if (n1 < 10)
            {
                if (n1 == n2)
                    return true;
                else
                    return false;
            }

            int res = n1;
            int i = 0;
            int k = n1 % 10;

            while (i <= 9)
            {
                res += k;
                i++;
                k = (int)(n1 / Math.Pow(10, i) % 10);
            }

            if (res == n2)
                return true;
            else
                return false;
        }

        static void Main(string[] args)
        {
            int num = int.Parse(Console.ReadLine());

            //for (num = 1; num <= 1000000000; num++)
            //{
            //    Console.WriteLine(num);

                if (num < 10)
                {
                    Console.WriteLine("0");
                return;
              //      Console.WriteLine("#########");
              //      Thread.Sleep(800);
             //       continue;
                }

                List<int> output = new List<int>();
                int res = 1;

                while (res <= num)
                {
                    if (Match(res, num))
                        output.Add(res);

                    res++;
                }

                Console.WriteLine(output.Count);

                for (int i = 0; i < output.Count; i++)
                    Console.WriteLine(output[i]);

            //    Thread.Sleep(800);
            //    Console.WriteLine("##########");
            //}
        }
    }
}

using System;
using System.Collections.Generic;

class Program
{
    private static void Main(string[] args)
    {
        int inputNumber = Int32.Parse(Console.ReadLine());
        List<int> findedNumbers = new List<int>();

        for (int i = 10; i < inputNumber; i++)
        {
            char[] parsedInputNumber = i.ToString().ToCharArray();

            int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());
            int secondDigit = Int32.Parse(parsedInputNumber[1].ToString());
            int thirdDigit = 0;

            if (i > 99)
            {
                thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());
            }

            int currentVariant = i + firstDigit + secondDigit + thirdDigit;

            if (currentVariant == inputNumber)
            {
                findedNumbers.Add(i);
            }
        }

        Console.WriteLine(findedNumbers.Count);

        if (findedNumbers.Count > 0)
        {
            foreach (int findedNumber in findedNumbers)
            {
                Console.WriteLine(findedNumber);
            }
        }
        Console.ReadLine();
    }
}

using System;
using System.Collections.Generic;

class Program
{
    private static void Main(string[] args)
    {
        string inputData = Console.ReadLine();
        int inputNumber = inputData.Length < 4 ? Int32.Parse(inputData) : 0;

        if (inputNumber > 0 && inputNumber < 110)
        {
            FindNumbers(inputNumber);
        }
        else
        {
            Console.WriteLine(0);
        }

        Console.ReadLine();
    }

    private static void FindNumbers(int inputNumber)
    {
        List<int> findedNumbers = new List<int>();

        for (int i = 1; i < inputNumber; i++)
        {
            char[] parsedInputNumber = i.ToString().ToCharArray();

            int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());
            int secondDigit = 0;
            int thirdDigit = 0;

            if (i > 9)
            {
                secondDigit = Int32.Parse(parsedInputNumber[1].ToString());
            }

            if (i > 99)
            {
                thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());
            }

            int currentVariant = i + firstDigit + secondDigit + thirdDigit;

            if (currentVariant == inputNumber)
            {
                findedNumbers.Add(i);
            }
        }

        Console.WriteLine(findedNumbers.Count);

        if (findedNumbers.Count > 0)
        {
            foreach (var findedNumber in findedNumbers)
            {
                Console.WriteLine(findedNumber);
            }
        }
    }
}

using System;
using System.Collections.Generic;

class Program
{
    private static void Main(string[] args)
    {
        int inputNumber = Int32.Parse(Console.ReadLine());
        List<int> findedNumbers = new List<int>();

        for (int i = 10; i < inputNumber; i++)
        {
            char[] parsedInputNumber = i.ToString().ToCharArray();
            int firstDigit = Int32.Parse(parsedInputNumber[0].ToString());
            int secondDigit = 0;
            int thirdDigit = 0;

            if (i > 9)
            {
                secondDigit = Int32.Parse(parsedInputNumber[1].ToString());
            }

            if (i > 99)
            {
                thirdDigit = Int32.Parse(parsedInputNumber[2].ToString());
            }

            int currentVariant = i + firstDigit + secondDigit + thirdDigit;

            if (currentVariant == inputNumber)
            {
                findedNumbers.Add(i);
            }
        }

        Console.WriteLine(findedNumbers.Count);

        if (findedNumbers.Count > 0)
        {
            foreach (int findedNumber in findedNumbers)
            {
                Console.WriteLine(findedNumber);
            }
        }

        Console.ReadLine();
    }
}

using System;
using System.Collections.Generic;

namespace Testing
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Convert.ToInt32(Console.ReadLine());
            List<int> values = new List<int>();
            int quantity = 0;
            for(int currentValue = n; currentValue > n - 100 && currentValue > 0; currentValue--)
            {
                int temporaryValue = currentValue;
                int sum = currentValue;
                while(temporaryValue > 0)
                {
                    sum += temporaryValue % 10;
                    temporaryValue /= 10;
                }
                if(sum == n)
                {
                    quantity++;
                    values.Add(currentValue);
                }
            }
            Console.WriteLine(quantity);
            foreach(int value in values)
            {
                Console.WriteLine("{0}", value);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt64();
            var max = (long) 1e3;
            var count = 0;
            for (var i = n; i <= n + max; i++) {
                var str = i.ToString();
                var sum = i;
                for (var j = 0; j < str.Length; j++) {
                    sum += str[j] - '0';
                }
                if (sum == n) {
                    count++;
                }
            }
            for (var i = n - max; i < n; i++) {
                var str = i.ToString();
                var sum = i;
                for (var j = 0; j < str.Length; j++) {
                    sum += str[j] - '0';
                }
                if (sum == n) {
                    count++;
                }
            }

            sw.WriteLine(count);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var n = s.I();
            int sum = 0;
            for (int i = Math.Max(0,n - 2*s.Length * 10); i < n; i++)
            {
                if (S(i) == n)
                {
                    H.A(i);
                    sum++;
                }
            }
            Console.WriteLine(sum);
            Console.Write(H.Str());
        }
        static int S(int n)
        {
            var t = n;
            var k = n;
            while (k != 0)
            {
                t += k % 10;
                k = k / 10;
            }
            return t;
        }
    }
    static class H
    {
        public static int I(this string str)
        {
            return int.Parse(str);
        }

        public static StringBuilder builder = new StringBuilder();

        public static void A(object a)
        {
            builder.Append(a);
        }

        public static string Str()
        {
            return builder.ToString();
        }
        static IEnumerable<int> Read(TextReader rdr)
        {
            int ch;
            bool neg = false;
            int value = 0;
            int count = 0;

            while (-1 != (ch = rdr.Read()))
            {
                if (ch == 9 || ch == 10 || ch == 13 || ch == 32)
                {
                    if (count > 0)
                        yield return neg ? -value : value;
                    count = 0;
                    value = 0;
                    neg = false;
                }
                else if (count == 0 && ch == '-')
                {
                    neg = true;
                }
                else if (ch >= '0' && ch <= '9')
                {
                    count++;
                    value = value * 10 + (ch - '0');
                }
                else
                    throw new InvalidDataException();
            }

            if (count > 0)
                yield return neg ? -value : value;
        }
    }
}