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

using namespace std;

long long int mop(vector<long long int>& tab, int start) {
    if (start == tab.size() - 1) {
        return tab[start] % 2 == 0 ? 1 : 0;
    }
    
    long long int sum = 0, result =0;
    for (int i = start ; i < tab.size(); i++) {
        sum = (sum + tab[i]) % 1000000007;
        if (sum % 2 == 0 && i < tab.size() - 1) {
            result = (result + mop(tab, i + 1)) %  1000000007;
        } else if (sum % 2 == 0 && i == tab.size() - 1) {
            return (result +1)  %  1000000007;
        }
    }
    return result %  1000000007;
}

int main()
{
    int n, num;
    cin>>n;
    
    vector< long long int > tab(n);
    
    for (int i = 0; i < n; i++) {
        cin>>tab[i];
    }
    cout<<mop(tab, 0)<<endl;
    return 0;
}