Problem D
Deildadrottnun
Languages
en
is
The government is currently examining the universities’ finances. Last contest had you follow a system in which all departments got the same amount of money. This along with some other constraints made it such that some money went unused, which clearly has to be fixed. This time the government will assign each department some budget and remove all grant and funding request processes. This is done because some professors were so tired of grants and funding applications that they had started to bribe others into taking care of it for them.
To make sure the plutonium reserves of the universities of Iceland do not fall into the wrong hands it is important this is done well.
The departments of the universities have been ordered by size and should get appropriate funding, so no two departments that get funding can get the same amount of funding. Furthermore the first funded department must get one or two million ISK exactly. The next funded department must get two or three million ISK, the third exactly three or four million ISK and so on.
Input
The first and only line of input contains an integer $n$, the amount of money to distribute, counted in millions of ISK. It is guaranteed that $1 \leq n \leq 10^{10}$.
Output
The first line of output should contain a single integer, the number of departments that get funding. The next line should print the amount of money each department gets, given in increasing order and separated by spaces, all given in terms of millions of ISK. If there is more than one way to distribute the funding such that all constraints are met, any one of them will be accepted. The input will be such that at least one solution exists.
Sample Input 1 | Sample Output 1 |
---|---|
6 |
3 1 2 3 |
Sample Input 2 | Sample Output 2 |
---|---|
16 |
5 1 2 3 4 6 |