#P7071. Excellent Partition

    ID: 20277 Type: Default 1000ms 256MiB

Excellent Partition

Excellent Partition

Given a positive integer n, determine whether there exists an excellent partition of n. A partition is called excellent if n is expressed as the sum of several distinct powers of 2, where each power is of the form \(2^k\) with k being a positive integer (i.e. \(k \ge 1\)).

For example, for n = 10, we have
\(10 = 8 + 2 = 2^3 + 2^1\), which is an excellent partition. However, n = 7 has a partition \(7 = 4 + 2 + 1 = 2^2 + 2^1 + 2^0\), but it is not considered excellent because \(1 = 2^0\) and the exponent 0 is not positive.

Your task is to determine whether there is any excellent partition for the given n. If there is one, output one valid partition scheme; otherwise, output -1.

inputFormat

The input consists of a single positive integer n (n ≥ 1).

outputFormat

If an excellent partition exists, output two lines. The first line contains a single integer representing the number of summands in your partition, and the second line lists the summands (which are distinct powers of 2 with positive exponents) separated by spaces. If no such partition exists, output -1.

sample

1
-1