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
44
45
46
#include <iostream>

using namespace std;
const int maxN = 300000, mod = 1e9 + 7;
long long tab[maxN], n, pa[2];

long long fastPot(long long pod, long long wyk)
{
	if (wyk == 2)
		return (pod * pod) % mod;
	else if (wyk == 1)
		return pod % mod;
	else if (wyk == 0)
		return 1;

	return (fastPot(fastPot(pod, wyk / 2) % mod, 2) % mod) * (fastPot(pod, wyk % 2) % mod) % mod;
}
long long dwuZbior()
{
	int wyn = 1;
	for (int i = n; i <= 0; i -= 2)
	{
		wyn *= i * (i - 1) / 2;
		wyn %= mod;
	}
	return wyn;
}
int main()
{
	long long wyn = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> tab[i];
		pa[tab[i] % 2]++;
	}
	if (pa[1] % 2 == 1)
	{
		cout << 0;
		return 0;
	}
	wyn = fastPot(2, pa[0]) * fastPot(2,dwuZbior());
	wyn %= mod;
	cout << wyn;
	return 0;
}