Sums in threes
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given a natural number n, your task is to construct a sequence of integers a_{-1}, a_0, a_1, ..., a_m such that:
- 0 = a_{-1} = a_0 < a_1 < a_2 < ... < a_m ≤ n - a_k > k^3/56 for all 1 ≤ k ≤ m - For every x in the set {1, 2, ..., n}, there exist indices i, j, k such that -1 ≤ i < j < k ≤ m and x = a_{i} + a_{j} + a_k.
It is guaranteed that such a sequence exists.
Input
The input consists of a single line containing the number n (where n ≤ 10^8).
Output
Output the integer m on the first line. On the second line, print the sequence of numbers a_1, a_2, ..., a_m, separated by spaces. If multiple solutions are possible, you may output any one of them.
Examples
Input #1
Answer #1
Submissions 31
Acceptance rate 13%