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
#include<cstdio>
#include<algorithm>
#define S 5007

using namespace std;
typedef long long ll;


int T[S];
ll dp[S];
ll mod = 1000000007;

int main(void){
    int n;
    scanf("%d",&n);
    for(int i = 1; i <= n;i++){
        scanf("%d",&T[i]);
    }
    sort(T+1,T+n+1);
    dp[0] = 1;
    ll x = 0;
    for(int i = 1; i <= n;i++){
        int c = T[i];
        x *= 2;
        x %= mod;
        for(int j = 5000; j >= c-1;j--){
            if(j + c > 5000){
                x += dp[j];
                x %= mod;
            }else{
                dp[j+c] += dp[j];
                dp[j+c] %= mod;
            }
        }
    }
    ll odp = 0;
    for(int i = 1; i <= 5000;i++){
        odp += dp[i];
    }
    odp += x;
    odp %= mod;
    printf("%lld",odp);




    return 0;
}