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
#include <bits/stdc++.h>
using namespace std;
const int MOD=1000000007;
const int SIZE=5100;
void imax(int &a, int b){
	a=max(a, b);
}
void imin(int &a, int b){
	a=min(a, b);
}
void lmax(long long &a, long long b){
	a=max(a, b);
}
void lmin(long long &a, long long b){
	a=min(a, b);
}
/*
	WARNING: I'm using strange bracket style!
*/
long long dp[SIZE];
vector <int> v;
long long res;
int q, x;
int main()
	{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>q;
	while (q--)
		cin>>x, v.push_back(x);
	sort(v.begin(), v.end()), dp[0]=1;
	for (auto g: v)
		for (int i=SIZE-1; i>=g-1; i--)
			(dp[min(i+g, SIZE-1)]+=dp[i])%=MOD;
	for (int i=1; i<SIZE; i++)
		(res+=dp[i])%=MOD;
	cout<<res<<endl;
	return 0;
	}