eolymp
bolt
Try our new interface for solving problems
Problems

Amounts

Amounts

Given \textbf{n }integers \textbf{a_1}, \textbf{a_2}, ..., \textbf{a_n}. Find the number of different values of the sums of the form \textbf{k_1a_1} +\textbf{ k_2a_2} + ... + \textbf{k_na_n}. \InputFile The first line contains the number \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{500}), the second - the numbers \textbf{a_1}, \textbf{a_2}, ..., \textbf{a_n} (\textbf{0} ≤ \textbf{a_i} ≤ \textbf{100}). It is known that \textbf{0} ≤ \textbf{k_i} ≤ \textbf{1} and all numbers are integers. \OutputFile Print the number of different values of the sums.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3
1 1 2
Output example #1
5