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
57
58
59
60
61
62
63
64
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long n, pref[300002], wyn, dp[300002], a[300002], b;
void brt(int id)
{
    if (id >= n)
    {
        //  cout << id << endl;
        wyn++;
        return;
    }
    long long sm = 0;
    for (int i = id; i < n; ++i)
    {
        sm += a[i];
        sm %= mod;
        if (sm % 2 == 0)
        {
            // cout << id << " " << i << " " << sm << endl;
            brt(i + 1);
        }
    }
}
int main()
{
    scanf("%lld", &n);
    if (n <= 3000)
    {
        for (int i = 0; i < n; ++i)
        {
            scanf("%lld", &a[i]);
        }
        brt(0);
        printf("%lld", wyn);
    }
    else
    {
        for (int i = 0; i < n; ++i)
        {
            scanf("%lld", &b);
            pref[i] = b;
            if (i > 0)
                pref[i] += pref[i - 1];
            pref[i] %= mod;
            // cout << pref[i] << endl;
        }

        // return 0;
        long long p = 0, np = 0;
        for (int i = 0; i < n; ++i)
        {
            if (pref[i] % 2 == 0)
            {
                dp[i] = p + 1;
                dp[i] %= mod;
                p += dp[i];
                p %= mod;
                // cout << p << " " << pref[i] << " " << i << endl;
            }
        }
        printf("%lld", dp[n - 1]);
    }
}