Money Sums#11504

Money Sums

1 segundo
128 megabytes
Fácil (≈1000)

You have coins with given denominations. Find all sums that can be obtained using these coins.

Entrada

The first line contains one integer n~(1 \le n \le 100) — the number of coins.

The second line contains integers x_1, x_2, \ldots, x_n~(1 \le x_i \le 1000) — the denominations of the coins.

Salida

In the first line, print the number of distinct sums that can be obtained.

In the second line, print all possible sums in increasing order.

Ejemplos

Ejemplo 1

Loading
Loading