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
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <climits>

using namespace std;

long a[300002];
long b[300002];

int main()
{
	long p = 1000000007;
	long n;
	scanf("%ld", &n);
	b[0] = 1;
	for (long i = 1; i <= n; ++i)
	{
		long res = 0, sum = 0;
		scanf("%ld", &a[i]);
		for (long j = i; j > 0; --j)
		{
			sum = (sum + a[j]) % p;
			if (sum % 2 == 0)
				res = (res + b[j - 1]) % p;
		}
		b[i] = res;
	}
	printf("%ld", b[n]);
	return 0;
}