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
#include<iostream>
#include<vector>

using namespace std;

long long MOD=1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;

    vector<long long> tab(n+1);

    for(int i=1;i<=n;i++)
    {
        cin>>tab[i];
    }

    vector<long long> possibilities(n+1,0);

    possibilities[0]=1;

    for(int x=1;x<=n;x++)
    {
        long long sum=0;
        for(int i=x;i>0;i--)
        {
            //sum+=tab[i];
            sum=(sum+tab[i])%MOD;

            if((sum%MOD)%2==0)
            {
                //possibilities[x]+=possibilities[i-1];
                possibilities[x]=(possibilities[x]+possibilities[i-1])%MOD;
            }
        }
    }

    /*for(int i=1;i<=n;i++)
    {
        cout<<possibilities[i]<<endl;
    }*/

    cout<<possibilities[n]<<endl;

    return 0;
}