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>

const unsigned long long MOPADULO = 1000000007;
unsigned long long info[300000] = { 0 };
unsigned long long counter = 0;

unsigned long long sum(int a, int b) {
	if (a == 0)
		return info[b];
	else
		return info[b] - info[a];
}

bool is_parity(unsigned long long number) {
	if ((number % MOPADULO) % 2 == 0)
		return true;
	else
		return false;
}

bool is_mopadulo(int beg, int end) {
	if (!is_parity(sum(beg, end)))
		return false;
	for (int i = beg; i < end; i++) {
		if (is_mopadulo(beg, i) && is_mopadulo(i + 1, end))
				counter++;
	}
	return true;
}

int main() {
	std::ios::sync_with_stdio(false);
	int n = 0;
	unsigned long long temp = 0;
	std::cin >> n;

	unsigned long long sum = 0;
	for (int i = 0; i < n; i++) {
		std::cin >> temp;
		sum += temp;
		info[i] = sum;
	}

	is_mopadulo(0, n);
	std::cout << (counter % MOPADULO) / n + (counter % MOPADULO) % n;
}