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
#include<bits/stdc++.h>
using namespace std;
const long long p = (long long)(1000000007);
bool mopadulo(long long number)
{
    return ((number % p) % 2 == 0);
}
long long diff(long long a, long long b)
{
    return max(a,b) - min(a,b);
}
int main()
{
    int n;
    cin>>n;
    vector<long long> num(n),sum(n),dp(n);
    for(int i = 0;i < n; i++){
        cin>>num[i];
    }
    sum[0] = num[0];
    for(int i = 1; i < n; i++){
        sum[i] = sum[i-1] + num[i];
        //sum[i] = sum[i] % p;
    }
    if(mopadulo(num[0]))
        dp[0] = 1;
    //for(auto cur : num) cout<<cur<<" ";cout<<endl;
    //for(auto cur : sum) cout<<cur<<" ";cout<<endl;

    for(int i = 1; i < n; i++){
        //if(i % 10000 == 0)
        //cout<<n-i<<endl;
        if(mopadulo(sum[i])){
            //cout<<"hererre "<<i<<endl;
            dp[i]++;
        }
        for(int k = 1; k <= i; k++){

            //cout<<(mopadulo(sum[k-1]) && mopadulo(diff(sum[i],sum[k-1])))<<endl;

            if(mopadulo(sum[i]-sum[k-1])){
                //cout<<"i = "<<i<<" k = "<<k<<endl;
                //cout<<"chuj kurwa "<<dp[i]<<" "<<dp[k-1]<<endl;
                dp[i] += dp[k-1];
                dp[i] = dp[i] % p;
            }
        }
    }
    //for(auto cur : dp) cout<<cur<<" ";cout<<endl;
    cout<<dp[n-1]<<endl;
}