eolymp
bolt
Try our new interface for solving problems
Problems

Money Sums

Money Sums

You have $n$ coins with certain values. Your task is to find all money sums you can create using these coins. \InputFile The first line has an integer $n\:(1 \le n \le 100)$: the number of coins. The next line has $n$ integers $x_1, x_2, ..., x_n\:(1 \le x_i \le 1000)$: the values of the coins. \OutputFile In the first line print the number of distinct money sums. In the second line print all possible sums in increasing order.
Time limit 1 second
Memory limit 128 MiB
Input example #1
4
4 2 5 2
Output example #1
9
2 4 5 6 7 8 9 11 13