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;

long long MOD = 1e9+7;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vector<int> dp(n+1);
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
        long long sum = 0;
        for (int j = i; j >= 0; j--) {
            sum += v[j];
            sum %= MOD;
            if (sum % 2 == 0) {
                dp[i+1] += dp[j];
                dp[i+1] %= MOD;
            }
        }
    }
    cout << dp[n] << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed;
    cout.precision(12);

    int T = 1;
    //cin >> T;
    for (int t = 0; t < T; t++) {
        solve();
    }

    return 0;
}