Collection of Postage Stamps
Ограничения: время – 300ms/2s, память – 32MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод
Послать решение Blockly Посылки Темы Где Обсудить (0)
Bob collects postage stamps. Every stamp has not only a nice picture, but also a number, which is nominal cost. Once Bob decided to count how many different sums may be composed from his stamps, but after some thousands variants he lost his way. He needs your help badly!
Write the program for calculation of the quantity of different sums, which may be composed from Bob’s stamps.
Input
The first line of the input file contains an integer `N\ (1≤N≤1000)`, which is equal to the amount of Bob’s stamps. The following `N` lines contain the nominal costs of Bob’s stamps (a single integer from 1 to 1000 in a line).
Output
Write into the output file the quantity of different sums, which may be composed from stamps of given nominal costs.
Output for the sample input
7