4085 - Excellent Lists

Created by Marcelo Fornet Fornés & Aurora Gil Pons
Added by ymondelo20 (2018-09-05)
Limits
Total Time: 10000 MS | Test Time: 1000 MS |Memory: 512 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

Given an integer N find the shortest list of numbers such that:
  • Each number is a power of 2.
  • The mean of all numbers in the list is equal to N.
Find the least lexicographical among all such lists.

Note: List A is lexicographically less than B if there is a number k such that A[i] = B[i] for all i < k and A[k] < B[k].
Dado un entero N encuentra la lista de números más corta de forma que:
  • Cada número es una potencia de 2.
  • La media de todos los número en la lista es igual a N.
Encuentra la menor lexicográficamente entre todas esas listas.

Nota: La lista A es menor lexicográficamente que B si existe un número k tal que A[i] = B[i] para todo i < k y A[k] < B[k].
Given an integer N find the shortest list of numbers such that:
  • Each number is a power of 2.
  • The mean of all numbers in the list is equal to N.
Find the least lexicographical among all such lists.

Note: List A is lexicographically less than B if there is a number k such that A[i] = B[i] for all i < k and A[k] < B[k].

Input specification

The only line of input will contain a integer number N (1 <= N <= 10^12).
La única línea de entrada contendrá un número entero N (1 <= N <= 10^12).
The only line of input will contain a integer number N (1 <= N <= 10^12).

Output specification

If no valid list exists output a line with the integer number -1. Otherwise output one line with a integer k (the size of the list) and a second line with exactly k integers (the numbers on the list).
Si no existe ninguna lista válida imprima una línea con el número entero -1. De lo contrario imprima una línea con un entero k (el tamaño de la lista) y una segunda línea con exactamente k enteros (los números en la lista).
The only line of input will contain a integer number N (1 <= N <= 10^12).

Sample input

3

Sample output

2
2 4

Hint(s)