#P9256. Pop Music Fade‐Out
Pop Music Fade‐Out
Pop Music Fade‐Out
Matthew, a fan of pop music, has composed a new song and now needs to create a fade‐out ending. He wants to choose a non‐empty sequence of notes, where each note is represented by a positive integer indicating its loudness. For the musical effect he desires, the sequence of loudness values must be strictly decreasing.
In addition, each note with loudness \(x\) has an associated beat value defined as the number of 1's in the binary representation of \(x\), i.e. \(\mathrm{popcount}(x)\). For the ending, Matthew wants the sum of the beat values of all the notes to be exactly \(n\). It can be proven that at least one such sequence always exists.
Your task is to help him find the lexicographically smallest sequence (as defined below) that meets these requirements.
Lexicographical order: Given two sequences \(A\) and \(B\), let \(i\) be the first index where they differ. The sequence with the smaller integer at index \(i\) is considered lexicographically smaller. If one sequence is a prefix of the other, the shorter sequence is lexicographically smaller.
Note: All formulas are given in \(\LaTeX\) format.
inputFormat
The input consists of a single integer \(n\) (\(1 \le n\)).
outputFormat
Output the lexicographically smallest strictly decreasing sequence of positive integers (separated by spaces in one line) such that the sum of their beat values (i.e. \(\mathrm{popcount}(x)\)) equals \(n\).
sample
1
1