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

int n;
int t[300005];
long long r[300005];
long long p = 1000000007;

void input() {
    std::cin >> n;
    for (int i = 1; i <= n; ++i) {
        std::cin >> t[i];
    }
}

void solve_brute() {
    r[0] = 1;
    for (int i = 1; i <= n; ++i) {
        r[i] = 0;
        long long s = 0;
        for (int j = i; j > 0; --j) {
            s = (s + t[j]) % p;
            if (s % 2 == 0) {
                r[i] = (r[i] + r[j - 1]) % p;
            }
        }
        // std::cout << i << " " << r[i] << "\n";
    }
    std::cout << r[n] << "\n";
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    input();
    solve_brute();
    return 0;
}