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
47
48
49
50
51
52
53
54
55
56
#include <iostream>
using namespace std;

#define ll long long

const ll N =3e5+1;
const ll mod = 1e9+7;



ll n;
ll t[N], pref[N];


int main()
{
    cin >> n;
    for(ll i = 1; i <= n; i++)
    {
        cin >> t[i];
        pref[i] = t[i] + pref[i-1];
    }
    ll ile = 0;
    bool parity = 0;
    for(ll i = 1; i <= n; i++)
    {
        if(t[i] % 2 == 0 and parity == 0)
        {
            ile++;
        }
        else if(t[i] % 2 == 1 and parity == 0)
        {
            parity = 1;
        }
        else if(t[i] % 2 == 0 and parity == 1)
        {
            continue;
        }
        else if(t[i] % 2 == 1 and parity == 1)
        {
            parity = 0;
            ile++;
        }
    }
    if(parity)
    {
        cout << 0;
        return 0;
    }
    ll res = 1;
    for(ll i = 1; i < ile; i++)
    {
        res = (res*2) % mod;
    }
    cout << res;
}