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>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <numeric>

using namespace std;

constexpr int64_t M = 1'000'000'007;



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

    int n;
    cin>>n;

    vector<int64_t> a, cS;
    a.push_back(0);


    vector<pair<int64_t, int64_t>> sor;

    copy_n(istream_iterator<int64_t>(cin),n,back_inserter(a));

    partial_sum(begin(a), end(a), back_inserter(cS), [](int64_t x, int64_t y) {return (x+y)%M; } );


    vector<int64_t> K (n+1,0);

    K[0]=1;

    for (int k=1; k<=n; k++){
        for (int j=k-1; j>=0; j--){
            if  (  (( cS[k]+(M-cS[j]) )%M)%2 ==0 )
                K[k]=(K[k]+K[j])%M;
        }

    }
    cout<<K[n]<<endl;


    //transform( begin(a), end(a), back_inserter(sor), [i=0](int r)mutable {return make_pair(r,i++);}  );





    //transform( begin(a), end(a), ostream_iterator<char>(cout), [min_krol](int r) {return r>=min_krol?'T':'N';}  );

    return 0;
}