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
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	vector <long long> sp(n+1);
	vector <long long> ans(n+1, 0);
	long long suma_parzystych = 0, suma_nieparzystych = 0;

	int mod = 1'000'000'007;
	sp[0] = 0;
	ans[0] = 1;

	for(int i = 1, x; i<=n; ++i){
		cin >> x;
		sp[i] = sp[i-1]+x;
	}

	for(int i = 1; i<=n; ++i){
		if((sp[i]-sp[i-1])%2 == 0) ans[i] = (ans[i]+ans[i-1])%mod;

		for(int j = i-1; j>0; --j){
			if(((sp[i]-sp[j-1])%mod)%2 == 0) ans[i] = (ans[i]+ans[j-1])%mod;
		}
	}

	cout << ans[n] << "\n";

}