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
42
43
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef vector<int> vint;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

lld t[8192];
int p[8192];
int n,s;
lld wyn;
constexpr lld mod = 1000000007;

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i) scanf("%d",p+i);
	sort(p,p+n);
	
	t[0]=1;
	for(int i=0;i<n;++i){
		for(int j=0;j<=min(5002-p[i],p[i]);++j){
			t[5001]=(t[5001]+t[5001-j])%mod;
		}
		for(int j=5000-p[i];j>=p[i]-1;--j){
			t[j+p[i]]=(t[j+p[i]]+t[j])%mod;
		}
	}
	for(int i=1;i<=5001;++i){
		wyn=(wyn+t[i])%mod;
		//if(t[i]!=0) printf("%d: %lld\n",i,t[i]);
	}
	printf("%lld",wyn);
	
	return 0;
}
/*
13
1 2 4 8 16 32 64 128 256 512 1024 2048 4096
*/