Under construction

Still being built. Things may change

Cafeteria Queue

Time limit2sMemory limit1024 MB

Summary
Given n, find the maximum number of expansion stages k and the per-stage push counts a_i that grow a two-student line to exactly n students.
Level

Medium6 of 10

Topics
Number theory, Math
Solved
No attempts yet

Statement

Innokentiy, the chief steward of the cafeteria at the Galactic School of Goodness, loves order. Yet every day during the very long break, when students head to lunch, chaos takes over his domain.

It starts innocently: the two fastest students stand in line. Then the line grows in kk stages. In stage ii (1≤i≤k1 \leq i \leq k), aia_i people push into every gap between neighboring students already in line. For example, with k=2k = 2, a1=3a_1 = 3, a2=1a_2 = 1, the line has 5 people after the first stage and 9 after the second.

Innokentiy wants to bring this under control. He knows only the final number of students nn in the line, and he wants to find out how the line expanded. Since nn does not determine the process uniquely, he wants the maximum possible number of stages kk and a matching sequence aia_i (1≤i≤k1 \leq i \leq k), giving the number of people who pushed into each gap at each stage.

Input

A single integer nn is given (3≤n≤264−13 \leq n \leq 2^{64} - 1), the final number of students in the line.

Output

On the first line, print the maximum number of stages kk. On the second line, print kk positive integers a1,…,aka_1, \dots, a_k separated by spaces. If several sequences of maximum length exist, print any one of them.

Hint

In the first example, there is only one possibility: two people push in during the first stage. In the second example, the process is not determined uniquely. One scenario with k=2k = 2 is given in the statement, but the maximum number of stages is 3.

Examples2

  1. Example 1

    Input
    4
    
    Expected output
    1
    2
    
  2. Example 2

    Input
    9
    
    Expected output
    3
    1 1 1