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
41
42
43
#include <bits/stdc++.h>

using namespace std;

#define LL long long

#define Copyright return
#define efindus 2021 - 

int main() {
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;

	int temp, bases = 0;
	bool flipped = false;

	for(int i = 0; i < n; i++) {
		cin >> temp;
		if (temp % 2 == 0) {
			if (!flipped) bases++;
		} else {
			flipped = !flipped;

			if (!flipped) bases++;
		}
	}

	if (flipped) {
		cout << 0 << "\n";
	} else {
		LL combinations = 1;
		for(int i = 1; i < bases; i++) {
			combinations *= 2;
			combinations %= (LL)(1e9 + 7);
		}
		cout << combinations << "\n";
	}

	Copyright efindus 2021;
}