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
#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
long long pre[300002];
int tab[300002],podzialy1[300002],podzialy2[300002];
long long pot2(int n){
	long long p = 1;
	for(int i = 1; i <= n; i++) p *= 2 % mod;
	return p;
}
int main() {
	ios_base::sync_with_stdio(0);
	int n, i, jedynka = 0, il_podz1 = 0,podzial = 0;
	long long pparz = 0, pmod = 0;
	cin >> n;
	for(i = 1; i <= n; i++)  {
		cin >> tab[i];	
	}
	for(i = 1; i <= n; i++) pre[i] = pre[i-1] + tab[i];
	if(pre[n] < mod){
		for(i = 1; i <= n; i++)  {
		if(tab[i] % 2 == 1) {
				if(jedynka == 0) jedynka++;
				else {
					jedynka = 0;
					il_podz1++;
				}
			}
		else {
			if(jedynka == 0) il_podz1++;	
			}
		}
		if(jedynka == 1) {
			cout << 0;
		}	
		else cout << pot2(il_podz1-1);
	}
		    
	return 0;
}