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
#include <stdio.h>
#define Prime 1000000007
typedef long long ll;
ll Numbers[400000];
ll Results[400000];

bool isMop(ll candidate) {
	return (candidate % Prime) % 2 == 0;
}

void CountFor(int idx) {
	if( idx == 0 ) {
		Results[0] = isMop(Numbers[0]) ? 1 : 0;
		return;
	}
	ll sum = Numbers[idx];
	for(int i = idx - 1; i >= 0; i--) {
		if( isMop( sum ) ) {
			Results[idx] += Results[i] % Prime;
		}
		sum += Numbers[i];
	}
	Results[idx] += isMop( sum ) ? 1 : 0;
}

int main() {
	int n;
	scanf("%d ", &n);
	for(int i=0; i<n; i++) {
		scanf("%lld ", &Numbers[i]);
		CountFor(i);
	}
	printf("%lld", Results[n-1] % Prime);
	return 0;
}