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
44
45
46
47
48
49
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

const int M = 10010;
ll T[M];
const int P = 1000000007;
vector<int> V;
 
int main() {
    int n; 
    
    scanf("%d",&n);
    V.resize(n);
   
    for (int i=0;i<n;i++) {
        scanf("%d", &V[i]);
    }
    sort(V.begin(), V.end());

    T[0]=1;
    for (int i=0;i<n;i++) {
        T[10005] <<= 1;
        T[10005] %= P;
        for (int j=10004; j>=V[i]-1;j--) {
        	if (V[i]+j >= 10005) {
        		T[10005] += T[j];
        		T[10005] %= P;
        	} else {
            	T[V[i]+j] += T[j];
            	T[V[i]+j] %= P;
            }
        }
    }
    ll res = 0L;
    for (int i=1;i<=10005;i++) {
        res += T[i];
        res %= P;
    }

    printf("%lld\n", res);

    return 0;
}