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
#include <iostream>
#include <vector>

typedef long long ll;
using namespace std;

const ll mod = 1e9 + 7;
const ll mod_res = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    vector<ll> prefix(n + 1);
    prefix[0] = 0;
    for(int i = 1; i <= n; ++i) {
        prefix[i] = (prefix[i - 1] + a[i - 1]) % mod;
    }

    vector<ll> dp(n + 1);
    dp[0] = 1;
    for(int k = 1; k <= n; ++k) {
        dp[k] = 0;
        for(int i = 0; i < k; ++i) {
            ll m = (prefix[k] - prefix[i] + mod) % mod;
            if(m % 2 == 1) continue;

            // if (([i+1;k] % mod) % 2) == 0
            dp[k] = (dp[k] + dp[i]) % mod_res;
        }
    }
    cout<<dp[n]<<'\n';
    
}
/*
dla mod = 5:
7
2 1 2 4 0 1 1

~ 10



*/