1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto & i : (a))
#define SZ(x) ((int)(x).size())
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;
typedef std::pair<int, int> PII;
typedef std::vector<int> VI;

const int MOD = 1000000007;
constexpr int N = 10005;
int dp[N];

int main(){
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0);

	int n;
	std::cin >> n;
	VI A(n);
	FOR(i, n) std::cin >> A[i];
	std::sort(A.begin(), A.end());
	dp[0] = 1;
	FOR(i, n){
		int a = A[i];
		FOR(j, a+1) dp[10001] = (dp[10001] + dp[10001-j])%MOD;
		for(int j = 10000; j >= 2*a-1; --j){
			dp[j] = (dp[j] + dp[j-a])%MOD;
		}
	}

	int ans = 0;
	REP(i, 1, N) ans = (ans + dp[i])%MOD;
	std::cout << ans << "\n";

	return 0;
}