Santa Claus has n candies, he dreams to give them as gifts to children.What is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of candies. Santa Class wants to give all n candies he has.

The only line contains positive integer number n (1 ≤ n ≤ 1000) — number of candies Santa Claus has.

Print to the first line integer number k — maximal number of kids which can get candies. Print to the second line k distinct integer numbers: number of candies for each of k kid. The sum of k printed numbers should be exactly n. If there are many solutions, print any of them.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];
    static List<int> anss = new List<int>();
    // Driver code
    public static void Main()
    {

        //int t = int.Parse(Console.ReadLine());
        //while (t > 0)
        {
            //  t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];
            // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            if(n==1)
            {
                Console.WriteLine(1);
                Console.WriteLine(1);
                return;
            }
            int i = 1;
            List<int> lst = new List<int>();
            var ans = 0;
            for (; i <= n; i++)
            {
                ans = ans + i;
                lst.Add(i);
                if (ans > n)
                {
                    ans = ans - i;
                    break;
                }
            }

            Console.WriteLine(i - 1);
            var left = n - ans;
            int j = 0;
            for (; j < lst.Count-left-1; j++)
            {
                Console.Write(lst[j] + " ");
            }
            for (; j < lst.Count - 1; j++)
            {
                Console.Write((lst[j]+1) + " ");
            }

        }

    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

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

namespace ConsoleApplication1
{
    public static class Problem753A
    {
        private const int Count = 1000;
        private static Dictionary<int, List<int>> dp = new Dictionary<int, List<int>>();

        private static void InitialiseTable()
        {
            dp[1] = new List<int>{1};
            dp[2] = new List<int>{2};

            for (var i = 1; i <= Count; i++)
            {
                if (!dp.ContainsKey(i))
                    dp[i] = new List<int>{};

                for (var j = i-1; j > 0; j--)
                {
                    var k = i - dp[j].Sum();
                    if (dp[j].Contains(k) || k<= 0 )
                    {
                        continue;
                    }
                    else
                    {
                        foreach (var c in dp[j])
                        {
                            dp[i].Add(c);
                        }
                        dp[i].Add(k);
                        break;
                    }
                }
            }

        }

        public static void Main( string[] args)
        {
            InitialiseTable();
            var i = int.Parse(Console.ReadLine().Trim());
            Console.WriteLine(dp[i].Count);
            Console.WriteLine(string.Join(" ", dp[i].Select(x => x.ToString())));

        }
    }
}

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)
		{
		   int n = int.Parse(Console.ReadLine());
		   int sum = 0;
		   int j = 0;
		   List<int> l = new List<int>();
		   while(j<=n)
		   {
		      sum++;
		      j += sum;
		      l.Add(sum);
		   }

		   l.Remove(j-n);

		   Console.WriteLine(l.Count);
		   for(int i=0;i<l.Count;i++)
		   {
		      Console.Write(l[i] + " ");
		   }
		}

	}
}

// Problem: 753A - Santa Claus and Candies
// Author: Gusztav Szmolik

using System;

class SantaClausAndCandies
    {
    static int Main ()
        {
        string[] words = ReadSplitLine (1);
        if (words == null)
            return -1;
        ushort n;
        if (!UInt16.TryParse (words[0], out n))
            return -1;
        if (n < 1 || n > 1000)
            return -1;
        byte k = 0;
        byte kNext = 1;
        ushort sum = 0;
        while (sum + kNext <= n)
            {
            sum += kNext;
            k = kNext;
            kNext++;
            }
        Console.WriteLine (k);
        byte r = Convert.ToByte (n-sum);
        byte numKidNoChangeCandies = Convert.ToByte (k-r);
        byte iLast = Convert.ToByte (k-1);
        for (byte i = 0; i < k; i++)
            {
            Console.Write (i < numKidNoChangeCandies ? i+1 : i+2);
            Console.Write (i < iLast ? ' ' : '\n');
            }
        return 0;
        }

    static string[] ReadSplitLine (uint numWordNeed)
        {
        string line = Console.ReadLine ();
        if (line == null)
            return null;
        char[] delims = new char[2] {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        return (words.Length == numWordNeed ? words : null);
        }
    }

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using static System.Math;

// https://codeforces.com/problemset/problem/753/A
public class A___Santa_Claus_and_Candies
{
    private static void Solve()
    {
        int n = ReadInt();

        int number = 0;
        int sum = 0;
        var list = new List<int>();
        while (sum <= n)
        {
            number++;
            sum += number;
            list.Add(number);
        }

        list.Remove(sum - n); // :O

        Write(list.Count);
        WriteArray(list);
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;

    public static void Main()
    {
#if DEBUG

        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;

        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());

        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();

            //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion Main

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string Read()
    {
        while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(Read());
    }

    public static long ReadLong()
    {
        return long.Parse(Read());
    }

    public static double ReadDouble()
    {
        return double.Parse(Read(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array) writer.WriteLine(a);
    }

    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    private static T[] Init<T>(int size) where T : new()
    {
        var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;
    }

    #endregion Read / Write
}

using System;
using System.Collections.Generic;

namespace ConsoleApp
{
    public class Program
    {
        public static void Main()
        {
            int n = Int32.Parse(Console.ReadLine());
            Stack<int> stack = new Stack<int>();
            for (int i = 1; n > 0; i++)
            {
                if (n >= i)
                {
                    n -= i;
                    stack.Push(i);
                }
                else
                {
                    stack.Push(stack.Pop() + n);
                    n = 0;
                }
            }
            Console.WriteLine(stack.Count);
            Console.Write(stack.Pop());
            while (stack.Count > 0)
            {
                Console.Write(" " + stack.Pop());
            }
        }
    }
}

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

namespace Santa_Claus_and_Candies
{
    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)
        {
            int n = Next() - 1;

            var nn = new Stack<int>();
            nn.Push(1);
            for (int i = 2;; i++)
            {
                if (n >= i)
                {
                    nn.Push(i);
                    n -= i;
                }
                else break;
            }
            nn.Push(n + nn.Pop());

            writer.WriteLine(nn.Count);
            foreach (int i in nn)
            {
                writer.Write(i);
                writer.Write(' ');
            }
            writer.Flush();
        }

        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;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _753A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> v = new List<int>();
            int sum = 0;
            for (int i = 1; sum + i <= n; i++)
            {
                v.Add(i);
                sum += i;
            }
            v[v.Count - 1] += n - sum;
            Console.WriteLine(v.Count);
            Console.WriteLine(string.Join(" ", v));
            //Console.ReadLine();
        }
    }
}

using System;

namespace CodeForces1
{
	class Program
	{
		static void Main(string[] args)
		{
			int n;
			int.TryParse(Console.ReadLine(), out n);
			int count = (int)Math.Sqrt(2 * n);
			if (count * (count + 1) > 2 * n) count--;
			Console.WriteLine(count);
			for (int i = 1; i<count; i++)
			{
				Console.Write($"{i} ");
				n -= i;
			}
			Console.WriteLine(n);
		}
	}
}

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

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

namespace _13ta
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION
            var n = readInt();
            var rem = n;
            var ans = new Stack<int>();
            var ca = 1;
            while (true)
            {
                if (rem - ca >= 0)
                {
                    ans.Push(ca);
                    rem -= ca;
                    ca++;
                }
                else
                {
                    break;
                }
            }

            var count = ans.Count;
            var res = ans.ToArray();
            Console.WriteLine(count);
            for (int i = 0; i < count; i++)
            {
                if (i == 0)
                {
                    Console.Write("{0} ", res[i] + rem);
                }
                else
                {
                    Console.Write("{0} ", res[i]);
                }
            }

            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

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

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

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}

using System;
using System.Collections.Generic;

namespace _753A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var addends = new List<int>();
            int total = 0;
            for (int i = 1; total + i <= n; i++)
            {
                addends.Add(i);
                total += i;
            }
            addends[addends.Count - 1] += n - total;

            Console.WriteLine(addends.Count);
            Console.WriteLine(string.Join(" ", addends));
        }
    }
}

using System;

namespace _753A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int count = 0;
            int total = 0;
            for (; total < n;)
            {
                total += ++count;
            }

            int remainder = 0;
            if (total > n)
            {
                remainder = n - total + count--;
            }

            int k = count;
            string[] counts = new string[k];
            for (int i = k - 1; i > -1; i--, count--)
            {
                counts[i] = k - i - 1 < remainder ? (count + 1).ToString() : count.ToString();
            }

            Console.WriteLine(k);
            Console.WriteLine(string.Join(" ", counts));
        }
    }
}

using System;
using System.Collections.Generic;

namespace Santa_Claus_and_Candies_codeforces753A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int balance = 0;
            List<int> candies = new List<int>();
            int sumOfCandies = 0;
            if (n == 1)
            {
                sumOfCandies = n;
                candies.Add(n);
            }
            else
            {

                for (int i = 1; i < n; i++)
                {
                    sumOfCandies = sumOfCandies + i;
                    if (sumOfCandies > n)
                    {
                        sumOfCandies = sumOfCandies - i;
                        break;
                    }
                    candies.Add(i);
                }
            }

            if (sumOfCandies != n)
            {
                balance = n - sumOfCandies;
                int j = candies.Count - 1;
                candies[j] = candies[j] + balance;
            }
            // printing all the results
            Console.WriteLine(candies.Count);
            foreach (var item in candies)
            {
                Console.Write(item + " ");
            }
            //Console.ReadKey();
        }
    }
}

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

namespace ConsoleApplication1A
{
  class Program753A
  {
    static void Main(string[] args)
    {

        int n = Convert.ToInt32(Console.ReadLine());

        int[,] M = new int [1001, 1001];

        for (int i = 0; i <= n; i++)
          for (int j = 0; j <= n; j++)
            M[i, j] = -1;
        M[0, 0] = 0;

        for (int i = 0; i < n; i++)
          for (int j = 0; j <= n; j++)
            if (M[i, j] >= 0)
              for (int k = M[i, j] + 1; k <= n; k++)
                if (j+k<=n) M[i + 1, j + k] = k;

      int jj = n;
      while (M[jj, n] < 0) jj--;

      Console.WriteLine(jj);

      int p = n;
      for (int kk = jj; kk > 0; kk--)
      {
        Console.Write(M[kk, p] + " ");
        p = p - M[kk, p];
      }

    }
  }
}

using System;
using System.Collections.Generic;

namespace tmp6
{
    class Program
    {

        static void Main()
        {
            int n = int.Parse(Console.ReadLine()), k = 0, tmpN = n, i = 1;
            List<int> l = new List<int>();
            while(n > 0)
            {
                n -= i;
                l.Add(i);
                k++;
                i++;
            }
            if(n < 0)
            {
                l.Remove(Math.Abs(n));
                k--;
            }
            Console.WriteLine(k);
            for (int j = 0; j < l.Count; j++)
                Console.Write(l[j] + " ");
        }
    }
}

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

namespace Rextester
{
    public class Program
    {
        public static void Main(string[] args)
        {

           int a = Convert.ToInt32(Console.ReadLine());
           List<int> lista = new List<int>();
            lista.Add(1);
           int cont=2;

            if(a==1){
                Console.WriteLine(1);
                Console.WriteLine(1);
            }else if(a==2){
                Console.WriteLine(1);
                Console.WriteLine(2);
            }else{
            while(lista.Sum()!=a){
                if(!lista.Contains(a-lista.Sum())){
                   lista.Add(cont);
                    cont++;
                }else{
                        lista[lista.Count-1]=lista[lista.Count-1]+(a-lista.Sum());
                    }
                }
                 string[]array=new string[lista.Count];
            for(int j=0;j<lista.Count;j++){
                array[j]=lista[j].ToString();
            }
            string result = string.Join(" ", array);
          Console.WriteLine(lista.Count);

            Console.WriteLine(result);
            }

        }
    }
}

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

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var arr = new int[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //var tastes = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = int.Parse(Console.ReadLine());
            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());

            var ans = new List<int>();
            //if (n <= 2)
            //{
            //    ans.Add(n);
            //}
            //else if (n == 3)
            //{
            //    ans.Add(1);
            //    ans.Add(2);
            //}
            //else
            //{
                ans.Add(n);
                bool ok = true;
                while (ok)
                {
                    ok = false;
                    //var tmp = new List<int>();
                    for (int i = 0; i <ans.Count(); i++)
                    {
                        int cur = ans[i];
                        for(int j =1; j<=cur/2; j++)
                        {
                            int a = j;
                            int b = cur - j;

                            if(!ans.Contains(a) && !ans.Contains(b) && a != b)//&& !tmp.Contains(a) && !tmp.Contains(b))
                            {
                                ans.RemoveAt(i);
                                ans.Add(a);
                                ans.Add(b);
                                ok = true;
                                i = 1000;
                                break;
                            }
                        }
                    }
                    //ans.AddRange(tmp);

                }
            //}

            Console.WriteLine(ans.Count());
            Console.WriteLine(string.Join(" ", ans));

            //Console.WriteLine();

        }

       public static bool number(char a)
        {
            if (a - '0' >= 0 && a - '0' <= 9) return true;
            else return false;
        }

        public static bool alph(char a)
        {
            if (a - 'A' >= 0 && a - 'A' <= 10) return true;
            else return false;
        }

    }

    class Segment
    {
        //public int[] arr;
        public Tuple<int, int, int, int, int>[] arr;
        int n;

        public Segment(int n)
        {
            this.n = n * 2;
            //arr = Enumerable.Range(0, n*2).ToArray();
            //arr = new int[this.n];
            arr = new Tuple<int, int, int, int, int>[this.n];
            for (int i = 0; i < this.n; i++)
            {
                arr[i] = Tuple.Create(0,0,0,0,0);
            }

        }

        public void update(int i, int x)
        {
            i = (n / 2) + i - 1;
            //arr[i] = 1;
            if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
            else if (x == 0) arr[i] = Tuple.Create( 0,1, 0, 0, 0);
            else if (x == 1) arr[i] = Tuple.Create(0,0,1,0,0);
            else if (x == 6) arr[i] = Tuple.Create( 0, 0, 0,1, 0);
            else if (x == 7) arr[i] = Tuple.Create( 0, 0, 0, 0,1);

            while (i > 0)
            {
                i = (i - 1) / 2;
                //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                //{
                //    arr[i] = arr[i*2+1];
                //}
                //else
                //{
                //    arr[i] = arr[i*2+2];
                //}
                //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                arr[i] = Tuple.Create(arr[i*2+1].Item1+ arr[i*2+2].Item1,
                    arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                    arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                    arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                    arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
            }

        }

        //call : query(a,b, 0, 0, n)
        public Tuple<int,int,int,int,int> query(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return Tuple.Create(0,0,0,0,0);
            if (a <= l && r <= b) return arr[k];
            else
            {

                var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                //if (vl.Item4 > vr.Item4)
                //{
                //    return vl;
                //}
                ////else if (vl.Item4 == vr.Item4)
                ////{
                ////    if (countA >= countB) return vr;
                ////    else return vl;
                ////}
                //else return vr;

                return Tuple.Create(vl.Item1 + vr.Item1,
   vl.Item2 + vr.Item2,
   vl.Item3 + vr.Item3,
  vl.Item4 + vr.Item4,
   vl.Item5 + vr.Item5);

                //return Math.Max(vl, vr);
                //return vl
                int countA = 0;
                int countB = 0;
                if (vl.Item1 == 0) countA++;
                if (vl.Item2 == 0) countA++;
                if (vl.Item3 == 0) countA++;
                if (vl.Item4 == 0) countA++;
                if (vl.Item5 == 0) countA++;

                if (vr.Item1 == 0) countB++;
                if (vr.Item2 == 0) countB++;
                if (vr.Item3 == 0) countB++;
                if (vr.Item4 == 0) countB++;
                if (vr.Item5 == 0) countB++;

                if((vl.Item1==0 && vr.Item1>0))
                {
                    return vr;
                }
                else if ((vl.Item1 > 0 && vr.Item1 == 0))
                {
                    return vl;
                }
                else if ((vl.Item2 == 0 && vr.Item2 > 0))
                {
                    return vr;
                }
                else if ((vl.Item2 > 0 && vr.Item2 == 0))
                {
                    return vl;
                }
                else if ((vl.Item3 == 0 && vr.Item3 > 0))
                {
                    return vr;
                }
                else if ((vl.Item3 > 0 && vr.Item3 == 0))
                {
                    return vl;
                }
                else if ((vl.Item4 == 0 && vr.Item4 > 0))
                {
                    return vr;
                }
                else if ((vl.Item4 > 0 && vr.Item4 == 0))
                {
                    return vl;
                }
                else if ((vl.Item5 == 0 && vr.Item5 > 0))
                {
                    return vr;
                }
                else if ((vl.Item5 > 0 && vr.Item5 == 0))
                {
                    return vl;
                }

                if (vl.Item4 > vr.Item4)
                {
                    return vl;
                }
                else if (vl.Item4 == vr.Item4)
                {
                    if (countA >= countB) return vr;
                    else return vl;
                }
                else return vr;

                //if (countA <= countB) return vl;
                //else return vr;
            }
        }

    }

    class UnionFind
    {
        public int[] path;

        public UnionFind(int n)
        {
            path = new int[n];

            for (int i = 0; i < n; i++)
            {
                path[i] = i;
            }

        }

        private int root(int i)
        {
            while (i != path[i])
            {
                path[i] = path[path[i]];
                i = path[i];
            }
            return i;
        }

        public bool find(int p, int q)
        {
            return root(p) == root(q);
        }

        public void unite(int p, int q)
        {
            int i = root(p);
            int j = root(q);
            path[i] = j;
        }

    }
}

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int candyAmount = Convert.ToInt32(Console.ReadLine());
            int sum = candyAmount;
            int counter = 1;
            List<int> list = new List<int>();

            while ((double)sum / 2 > counter)
            {
                sum -= counter;
                list.Add(counter++);
            }

            list.Add(sum);
            Console.WriteLine(list.Count);
            Console.WriteLine(string.Join(" ", list));

            Console.ReadLine();
        }
    }
}

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum =  Convert.ToInt32(Console.ReadLine());
            int  n = (int)((-1 + Math.Sqrt(1 + 8 * sum)) / 2);
            int i;
            int t = 0;

            Console.WriteLine(n);
            for (i = 1; i < n; i++)
            {
                Console.Write(i);
                Console.Write(' ');
                t += i;
            }
            Console.WriteLine(sum - t);

            Console.ReadLine();
        }
    }
}

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

namespace Test
{
    class Node
    {
        public int left;
        public int right;
        public Int64 sum;
    }
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int answer = 0;
            for(int i = 1; i <= 100; i++)
            {
                if(i*(i+1)/2 > n)
                {
                    answer = i - 1;
                    break;
                }
            }
            Console.WriteLine(answer);
            for(int i = 1; i < answer; i++)
            {
                Console.Write(i + " ");
                n -= i;
            }
            Console.Write(n);
        }
    }
}

//int n = int.Parse(Console.ReadLine());
//int[] h = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
//Array.Sort(data, (int a,int b) => a>b?-1:a==b?0:1);
//Console.WriteLine($"{left:f9}".Replace(',', '.'));
//Console.WriteLine(string.Format("{0:F10}",t).Replace(",","."));

//Sorted set
/*
SortedSet<int> set = new SortedSet<int>();
for(int i=1;i<=n;i++)
{
    set.Add(i);
}

SortedSet<int> temp = set.GetViewBetween(l, r);
SortedSet<int> del = new SortedSet<int>();
foreach (int t in temp)
{
    if(t != x)
    {
        answer[t] = x;
        del.Add(t);
        //set.Remove(t);
    }
}
foreach(int t in del)
{
    set.Remove(t);
}
*/

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

class Program
{
    static void Main(string[] args)
    {
        int n = RI();
        List<int> ans = new List<int>();
        ans.Add(1);
        n--;
        while (ans.Max() < n)
        {
            ans.Add(ans.Max() + 1);
            n -= ans.Max();
        }

        ans[ans.Count - 1] += n;

        Console.WriteLine(ans.Count);
        Console.WriteLine(string.Join(" ", ans));
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read
    private static char ReadSign()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans == '+' || ans == '-' || ans == '?')
                return (char)ans;
        }
    }

    private static long GCD(long a, long b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];
    static List<int> anss = new List<int>();
    // Driver code
    public static void Main()
    {

        //int t = int.Parse(Console.ReadLine());
        //while (t > 0)
        {
            //  t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];
            // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            if(n==1)
            {
                Console.WriteLine(1);
                Console.WriteLine(1);
                return;
            }
            int i = 1;
            List<int> lst = new List<int>();
            var ans = 0;
            for (; i <= n; i++)
            {
                ans = ans + i;
                lst.Add(i);
                if (ans > n)
                {
                    ans = ans - i;
                    break;
                }
            }

            Console.WriteLine(i - 1);
            var left = n - ans;
            int j = 0;
            for (; j < lst.Count-10; j++)
            {
                Console.Write(lst[j] + " ");
            }
            for (; j < lst.Count - 1; j++)
            {
                Console.Write((lst[j]+1) + " ");
            }

        }

    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];
    static List<int> anss = new List<int>();
    // Driver code
    public static void Main()
    {

        //int t = int.Parse(Console.ReadLine());
        //while (t > 0)
        {
            //  t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];
            // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            if(n==1)
            {
                Console.WriteLine(1);
                Console.WriteLine(1);
                return;
            }
            int i = 1;
            List<int> lst = new List<int>();
            var ans = 0;
            for (; i <= n; i++)
            {
                ans = ans + i;
                lst.Add(i);
                if (ans > n)
                {
                    ans = ans - i;
                    break;
                }
            }

            Console.WriteLine(i - 1);
            var left = n - ans;
            int j = 0;
            for (; j < left; j++)
            {
                Console.Write(lst[j] + 1 + " ");
            }
            for (; j < lst.Count - 1; j++)
            {
                Console.Write(lst[j] + " ");
            }

        }

    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];
    static List<int> anss = new List<int>();
    // Driver code
    public static void Main()
    {

        //int t = int.Parse(Console.ReadLine());
        //while (t > 0)
        {
            //  t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];
            // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            if(n==1)
            {
                Console.WriteLine(1);
                return;
            }
            int i = 1;
            List<int> lst = new List<int>();
            var ans = 0;
            for (; i <= n; i++)
            {
                ans = ans + i;
                lst.Add(i);
                if (ans > n)
                {
                    ans = ans - i;
                    break;
                }
            }

            Console.WriteLine(i - 1);
            var left = n - ans;
            int j = 0;
            for (; j < left; j++)
            {
                Console.Write(lst[j] + 1 + " ");
            }
            for (; j < lst.Count - 1; j++)
            {
                Console.Write(lst[j] + " ");
            }

        }

    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];
    static List<int> anss = new List<int>();
    // Driver code
    public static void Main()
    {

        //int t = int.Parse(Console.ReadLine());
        //while (t > 0)
        {
            //  t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            var n = input1[0];
            // var k = input1[1];
            // var arr = Console.ReadLine().Split(' ').Select(xx => int.Parse(xx)).ToArray();
            int i = 1;
            List<int> lst = new List<int>();
            var ans = 0;
            for (; i <= n; i++)
            {
                ans = (i * (i + 1)) / 2;
                lst.Add(ans);
                if (ans > n)
                {
                    break;
                }
            }

            Console.WriteLine(i - 1);
            var left = ans - n;
            int j = 0;
            for (; j < left; j++)
            {
                Console.Write(lst[j] + 1 + " ");
            }
            for (; j < lst.Count-1; j++)
            {
                Console.Write(lst[j] + " ");
            }

        }

    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

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

namespace ConsoleApplication1
{
    public static class Problem753A
    {
        private const int Count = 1000;
        private static Dictionary<int, List<int>> dp = new Dictionary<int, List<int>>();

        private static void InitialiseTable()
        {
            dp[1] = new List<int>{1};
            for (var i = 2; i <= Count; i++)
            {
                dp[i] = new List<int>();

                for (var j = i-1; j> 0; j--)
                {
                    var k = i - dp[j].Sum();
                    if (dp[j].Contains(k) || k<= 0 )
                    {
                        continue;
                    }
                    else
                    {
                        foreach (var c in dp[j])
                        {
                            dp[i].Add(c);
                        }
                        dp[i].Add(k);
                        break;
                    }
                }
            }
        }

        public static void Main( string[] args)
        {
            InitialiseTable();
            var i = int.Parse(Console.ReadLine().Trim());
            Console.WriteLine(dp[i].Count);
            Console.WriteLine(string.Join(" ", dp[i].Select(x => x.ToString())));

        }
    }
}

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

namespace ConsoleApplication1
{
    public static class Problem753A
    {
        private const int COUNT = 1000;
        private static Dictionary<int, List<int>> dp = new Dictionary<int, List<int>>();

        private static void InitialiseTable()
        {
            for (var i = 0; i <= COUNT; i++)
            {
                dp[i] = new List<int>();

                for (var j = i-1; j> 0; j--)
                {
                    var k = i - dp[j].Sum();
                    if (dp[j].Contains(k) || k<= 0 )
                    {
                        continue;
                    }
                    else
                    {
                        foreach (var c in dp[j])
                        {
                            dp[i].Add(c);
                        }
                        dp[i].Add(k);
                        break;
                    }
                }
            }
        }

        public static void Main( string[] args)
        {
            InitialiseTable();
            var i = int.Parse(Console.ReadLine().Trim());
            Console.WriteLine(dp[i].Count);
            Console.WriteLine(string.Join(" ", dp[i].Select(x => x.ToString())));

        }
    }
}

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

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var arr = new int[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            //string s = Console.ReadLine();
            //int n = int.Parse(Console.ReadLine());
            //var arr = new char[n][];//Console.ReadLine().Split().Select(int.Parse).ToArray();

            //for (int i = 0; i < n; i++)
            //{
            //    arr[i] = Console.ReadLine().ToArray();

            //}

            int n = int.Parse(Console.ReadLine());

            var ans = new List<int>();

            if (n > 3)
            {
                while (n>0)
                {
                    if (n == 3)
                    {
                        ans.Add(1);
                        ans.Add(2);
                        break;
                    }
                    else if (n <= 2)
                    {
                        ans.Add(n);
                        break;
                    }
                    else
                    {

                        int a = 0;
                        for (int j = 3; j <n; j++)
                        {
                            bool can = true;
                            for (int i = 2; i <= (int)Math.Sqrt(n); i++)
                            {
                                if (j % i == 0)
                                {
                                    //a = j;
                                    can = false;
                                    break;
                                }
                            }
                            if (can)
                            {
                                //ans.Add(n-j);
                                ans.Add(j);
                                n -= j;
                                break;
                            }
                        }
                    }
                }
            }
            else ans.Add(n);

            ans.Distinct();
            Console.WriteLine(ans.Count());
            Console.WriteLine(string.Join(" ", ans));

            //Console.WriteLine();

            //bool f = true;

            //if (f)
            //{
            //    Console.WriteLine("0000");
            //    f = false;
            //}
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int bull = num[0];
            //int cow = num[1];
            //var memo = new bool[4,4];
            //int count = 0;
            //var list = new List<int>();
            //bool first = false;
            //if (bull  != 4)
            //{

            //    var ans = new char[4];

            //    if(count<9 && cow>0 && list.Count()<4)
            //    {
            //        for(int i=0; i< cow; i++)
            //        {
            //            list.Add(count);
            //        }
            //        ans[0] = (char)(count+'0'+1);
            //        ans[1] = (char)(count+'0' + 1);
            //        ans[2] = (char)(count+'0' + 1);
            //        ans[3] = (char)(count+'0' + 1);
            //        first = true;
            //    }
            //    else
            //    {
            //        if(first)
            //        {
            //            ans[0] = (char)(list[0]+'0');
            //            ans[1] = (char)(list[1]+'0');
            //            ans[2] = (char)(list[2]+'0');
            //            ans[3] = (char)(list[3]+'0');

            //            count = 0;
            //            first = false;
            //        }
            //        else
            //        {
            //            char tmp = ans[0];
            //            char tmp2 = ans[1];
            //            char tmp3 = ans[2];
            //            if(count%2==0)
            //            {
            //                ans[0] = ans[2];
            //                ans[2] = tmp;
            //                ans[1] = ans[3];
            //                ans[3] = tmp2;
            //            }
            //            else
            //            {
            //                ans[0] = ans[1];
            //                ans[1] = tmp;
            //                ans[2] = ans[3];
            //                ans[3] = tmp3;
            //            }

            //        }

            //    }

            //    count++;
            //    Console.WriteLine(new string(ans));
            //}
            //else Console.WriteLine();

        }

    }

    class Segment
    {
        public Tuple<long, int>[] arr;
        int n;

        public Segment(int n)
        {
            this.n = n * 2;
            //arr = Enumerable.Range(0, n*2).ToArray();
            arr = new Tuple<long, int>[this.n];
            for (int i = 0; i < this.n; i++)
            {
                arr[i] = Tuple.Create((long)0, 0);
            }

        }

        public void update(int i, long x, int ind)
        {
            i = (n / 2) + i - 1;
            arr[i] = Tuple.Create(x, ind);
            while (i > 0)
            {
                i = (i - 1) / 2;
                //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                if (arr[i * 2 + 1].Item1 > arr[i * 2 + 2].Item1)
                {
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1, arr[i * 2 + 1].Item2);
                }
                else
                {
                    arr[i] = Tuple.Create(arr[i * 2 + 2].Item1, arr[i * 2 + 2].Item2);
                }

            }

        }

        //call : query(a,b, 0, 0, n)
        public long query(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return int.MaxValue;
            if (a <= l && r <= b) return arr[k].Item1;
            else
            {
                long vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                long vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
                return Math.Max(vl, vr);
            }
        }

    }

    class UnionFind
    {
        public int[] path;

        public UnionFind(int n)
        {
            path = new int[n];

            for (int i = 0; i < n; i++)
            {
                path[i] = i;
            }

        }

        private int root(int i)
        {
            while (i != path[i])
            {
                path[i] = path[path[i]];
                i = path[i];
            }
            return i;
        }

        public bool find(int p, int q)
        {
            return root(p) == root(q);
        }

        public void unite(int p, int q)
        {
            int i = root(p);
            int j = root(q);
            path[i] = j;
        }

    }
}

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int candyAmount = Convert.ToInt32(Console.ReadLine());
            int sum = candyAmount;
            int counter = 1;
            List<int> list = new List<int>();

            while ((double)(sum / 2) > counter)
            {
                sum -= counter;
                list.Add(counter++);
            }

            list.Add(sum);
            Console.WriteLine(list.Count);
            Console.WriteLine(string.Join(" ", list));

            Console.ReadLine();
        }
    }
}


Attention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're going to give you the answer, and you need to print a test case that produces the given answer. The original problem is in the following paragraph.People don't use cash as often as they used to. Having a credit card solves some of the hassles of cash, such as having to receive change when you can't form the exact amount of money needed to purchase an item. Typically cashiers will give you as few coins as possible in change, but they don't have to. For example, if your change is 30 cents, a cashier could give you a 5 cent piece and a 25 cent piece, or they could give you three 10 cent pieces, or ten 1 cent pieces, two 5 cent pieces, and one 10 cent piece. Altogether there are 18 different ways to make 30 cents using only 1 cent pieces, 5 cent pieces, 10 cent pieces, and 25 cent pieces. Two ways are considered different if they contain a different number of at least one type of coin. Given the denominations of the coins and an amount of change to be made, how many different ways are there to make change?As we mentioned before, we lost all the test cases for this problem, so we're actually going to give you the number of ways, and want you to produce a test case for which the number of ways is the given number. There could be many ways to achieve this (we guarantee there's always at least one), so you can print any, as long as it meets the constraints described below.

Input will consist of a single integer A (1 ≤ A ≤ 105), the desired number of ways.

In the first line print integers N and M (1 ≤ N ≤ 106, 1 ≤ M ≤ 10), the amount of change to be made, and the number of denominations, respectively. Then print M integers D1, D2, ..., DM (1 ≤ Di ≤ 106), the denominations of the coins. All denominations must be distinct: for any i ≠ j we must have Di ≠ Dj. If there are multiple tests, print any of them. You can print denominations in atbitrary order.

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

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
          int n = int.Parse(Console.ReadLine());

          Console.WriteLine(2*n-1 + " 2\n1 2");
        }

    }
}

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

namespace ConsoleApp13
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            if (a>1)
            {
                int b = (a - 1) * 2;
                Console.WriteLine( b+ " " + 2);
                Console.WriteLine("{0} {1}", 1, 2);
            }
            else
            {
                Console.WriteLine(1 + " " + 1);
                Console.WriteLine(1);
            }

        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Save_the_problem
{
    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)
        {
            int a = Next();

            writer.Write(2*a - 1);
            writer.WriteLine(" 2");
            writer.WriteLine("1 2");
            writer.Flush();
        }

        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.Globalization;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var n = ReadLong();
            if (n == 1)
                return "1 1\n1";
            return 2 * (n - 1) + " 2\n1 2";
        }

        class Trie
        {

        }

        class Node {
            public Node()
            {
                Children = new Node[10];
            }
            public Node[] Children { get; set; }
            public int Count { get; set; }
            public char Letter { get; set; }

            public string Final { get; set; }
            private int Rev = -1;

            public void RecursePlus()
            {
                if (Rev != -1)
                    Count++;
                for (int i = 0; i < 10; i++)
                {
                    if (Children[i] != null)
                    {
                        Children[i].RecursePlus();
                    }
                }
            }
            public void Insert(string s, int begin, int rev)
            {
                //Count++;
                if (rev != Rev)
                {
                    if (Rev != -1)
                        Count++;
                    Rev = rev;
                }
                if (begin == s.Length)
                {
                    Final = s;
                    return;
                }
                if (Children[s[begin] - '0'] == null)
                    Children[s[begin] - '0'] = new Node();
                Children[s[begin] - '0'].Insert(s, begin + 1, rev);
            }

            public void Recurse(Dictionary<string, string> dct, List<char> sofar)
            {
                if (Count == 1)
                    this.SetAns(dct, new string(sofar.ToArray()));
                else
                    for (int i = 0; i < 10; i++)
                    {
                        if (Children[i] != null)
                        {
                            sofar.Add(i.ToString()[0]);
                            Children[i].Recurse(dct, sofar);
                            sofar.RemoveAt(sofar.Count - 1);
                        }
                    }
            }
            public void SetAns(Dictionary<string, string> dct, string ans) {
                if (Final != null)
                {
                    if (!dct.ContainsKey(Final) || dct[Final].Length > ans.Length)
                        dct[Final] = ans;
                    return;
                }
                for (int i = 0; i < 10; i++)
                {
                    if (Children[i] != null)
                    {
                        Children[i].SetAns(dct, ans);
                        return;
                    }
                }
            }
        }

        class End
        {
            public long Val { get; set; }
            public bool Left { get; set; }
        }
    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }

}

using System;
 using System.CodeDom;
 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 a = sr.NextInt32();
            var s = 2 * a - 1;

            sw.WriteLine(s + " 2");
            sw.WriteLine("1 2");
        }

        ~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 Problem867B
{
    class Program
    {
        static void Main(string[] args)
        {
            long p = long.Parse(Console.ReadLine());
            Console.WriteLine("{0} 2\n1 2", Math.Max((p - 1) * 2, 1));
        }
    }
}

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

namespace Problem867B
{
    class Program
    {
        static void Main(string[] args)
        {
            long p = long.Parse(Console.ReadLine());
            Console.WriteLine("{0} 2\n1 2", Math.Max((p - 1) * 2, 1));
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
public class CodeForces
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = true;
#else
const bool testing = false;
#endif

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

    static void program(TextReader input)
    {
        var n = int.Parse(input.ReadLine().TrimEnd());

        //var data = input.ReadLine().Split(' ').Select(int.Parse).ToList();
        if (n == 1)
        {
            writer.WriteLine("1 1");
            writer.WriteLine("1");
            writer.Flush();
            return;
        }
        writer.WriteLine((n - 1) * 2 + " 2");
        writer.WriteLine("1 2");
        writer.Flush();
    }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("30 4\n1 5 10 25\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("18\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("20 2\n5 2\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("3\n"));
        Console.WriteLine();
        Console.ReadLine();

        Console.WriteLine("Test Case(3) => expected :");
        Console.WriteLine("183 4\n6 5 2 139\n");
        Console.WriteLine("Test Case(3) => found    :");
        program(new StringReader("314\n"));
        Console.WriteLine();
        Console.ReadLine();

    }
}

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

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            if(n == 1)
            {
                Console.WriteLine("1 1");
                Console.WriteLine("1");
                return;
            }
            Console.WriteLine(((n - 1) * 2).ToString() + " 2");
            Console.WriteLine("1 2");
        }
    }
}

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

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
          int n = int.Parse(Console.ReadLine());

          Console.WriteLine(2*n-1 + " \n1 2");
        }

    }
}

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

namespace Problem867B
{
    class Program
    {
        static void Main(string[] args)
        {
            long p = long.Parse(Console.ReadLine());
            Console.WriteLine("{0} 2\n1 2", (p - 1) * 2);
        }
    }
}

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

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            Console.WriteLine(((n - 1) * 2).ToString() + " 2");
            Console.WriteLine("1 2");
        }
    }
}

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

namespace TaskB
{
    class Program
    {
        static int Count(int num, int step)
        {
            if (num == 1 && step == 0)
                return 1;
            if (step < num / 5)
                return 0;
            if (num == 5)
                return 1;
            if (num == 10)
                return Count(5, step - 1) + Count(10, step - 2);
            if (num == 25)
                return Count(10, step - 3) + Count(25, step - 5);
            if (num == 50)
                return Count(25, step - 5) + Count(25, step - 10);
            return 0;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] arr = { 1, 5, 10, 25, 50 };
            int result = 0;
            int id = 0;
            int number = 0;
            int count = 0;
            string money = "";
            while(true)
            {
                result += Count(1, id) + Count(5, id) + Count(10, id) + Count(25, id) + Count(50, id);

                if (result >= n)
                {
                    number = id * 5;
                    break;
                }
                id++;
            }
            id = 0;
            while (number > arr[id])
            {
                id++;
                if (id == 5)
                    break;
            }
            count = id;
            for (int i = 0; i < count; i++)
            {
                money += arr[i].ToString();
                if (i != count - 1)
                    money += ' ';
            }
            Console.WriteLine(number.ToString() + " " + count.ToString());
            Console.WriteLine(money);
        }
    }
}

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

namespace TaskB
{
    class Program
    {
        static long Count(int num, int step)
        {
            if (num == 1 && step == 0)
                return 1;
            if (step < num / 5)
                return 0;
            if (num == 5)
                return 1;
            if (num == 10)
                return Count(5, step - 1) + Count(10, step - 2);
            if (num == 25)
                return Count(10, step - 3) + Count(25, step - 5);
            if (num == 50)
                return Count(25, step - 5) + Count(25, step - 10);
            return 0;
        }

        static void Main(string[] args)
        {
            long n = Convert.ToInt64(Console.ReadLine());
            int[] arr = { 1, 5, 10, 25, 50 };
            long result = 0;
            int id = 0;
            long number = 0;
            int count = 0;
            string money = "";
            while(true)
            {
                result += Count(1, id) + Count(5, id) + Count(10, id) + Count(25, id) + Count(50, id);

                if (result >= n)
                {
                    number = id * 5;
                    break;
                }
                id++;
            }
            id = 0;
            while (number > arr[id])
            {
                id++;
                if (id == 5)
                    break;
            }
            count = id;
            for (int i = 0; i < count; i++)
            {
                money += arr[i].ToString();
                if (i != count - 1)
                    money += ' ';
            }
            Console.WriteLine(number.ToString() + " " + count.ToString());
            Console.WriteLine(money);
        }
    }
}