#include #include using std::vector; vector optimal_summands(int n) { vector summands; int s = 0; for (int i = 1; ; i++) { s += i; if (s == n) { summands.push_back(i); break; } if (s > n) { s -= (i + i - 1); summands[summands.size() - 1] = (n - s); break; } summands.push_back(i); } return summands; } int main() { int n; std::cin >> n; vector summands = optimal_summands(n); std::cout << summands.size() << '\n'; for (size_t i = 0; i < summands.size(); ++i) { std::cout << summands[i] << ' '; } std::cout << '\n'; }