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
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

long long factorial(long long n); //Factorial
long long factorial(long long n, long long x ); // Factorial with modulo
bool isPowerOfTwo (long long x); //Function to check if x is power of 2
long long binpow(long long a, long long b); // return a ^ b
long long binpow(long long a, long long b, long long m); // return (a^b) mod m
long long lcm (long long a, long long b); // least common multiple
long long gcd(long long a, long long b, long long& x, long long& y); //extended euclidean algorithm
pair<long long, long long> fib (long long n); // n-th and (n+1)-th Fibonacci numbers
//dfs
long long mostSignificantDigit(long long N );
long long numberOfDigits(long long N );







typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> pi;
typedef vector<pair<long long,long long>> pll;


#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPA(i,a,b,c) for (int i = a; i <= b; i+=c)


//TRICKS

//Checking if the number is even or odd without using the % operator:
/*
if (num & 1) 
	cout << "ODD"; 
else
	cout << "EVEN"; 
*/

//emplace_back() instead of push_back()
/*
// are all of the elements positive?
all_of(first, first+n, ispositive()); 

// is there at least one positive element?
any_of(first, first+n, ispositive());

// are none of the elements positive?
none_of(first, first+n, ispositive()); 


Copy Algorithm: used to copy elements from one container to another.
// copy 5 elements from source to target
copy_n(source, sizeOfArray, target);

Initialization in Binary form
auto number = 0b011; 
cout << number;
OUTPUT: 3

*/

const int N_MAX = 300123;
const ll MOD = 1000000007;

int n;
ll a [ N_MAX ];
ll pref [ N_MAX ];
ll dp [ N_MAX ];





int main() {
	ios_base::sync_with_stdio(0);

    cin >> n;
    REP(i,1,n) {
        cin >> a [ i ];
    }  

    pref[1] = a[1];
    REP(i,2,n) {
        pref[i] = a[i] + pref[i-1];
        pref[i] %= MOD;
    }

    /*
    cout << "pref: " << '\n';
    REP(i,1,n) {
        cout << pref[i] << ' ';
    }
    cout << '\n';
    cout << '\n';
    */

    if(a[1]%2==0) {
        dp[1]=1;
    }

    REP(i,2,n) {
        //cout << i << ": " << '\n';
        REP(j,1,i-1) {
            //cout << "pref[" << i << "]-pref[" << j << "]: " << pref[i]-pref[j] << '\n';
            //cout << "z modem: " << ( pref[i]-pref[j] + MOD) % MOD << '\n';
           // cout << '\n';
            if( ( ( pref[i]-pref[j] + MOD) % MOD ) % 2 == 0 ) {
                dp[i] += dp[j];
                dp[i] %= MOD;
            }
        }
        if(pref[i]%2==0) {
            dp[i]++;
            dp[i]%=MOD;
        }
        //cout << '\n';
        //cout << '\n';
    }
    /*
    cout << "dp: " << '\n';
    REP(i,1,n) {
        cout << dp[i] << " ";
    }
    cout << '\n';
    cout << '\n';
    */


    cout << dp[n] << '\n';





	return 0;
}
/*
1000000006  1   5   1000000004
1           1





*/












long long factorial(long long n) 
{ 
    if (n == 0) 
        return 1; 
    return n * factorial(n - 1); 
} 

long long factorial(long long n, long long x ) {
    ll res = 1;
    for ( ll i = 1; i <= n; i++ ) {
        res *= i;
        res %= x;
    }
    return res;
}




// return a ^ b
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

// return (a^b) mod m
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
// least common multiple
long long lcm (long long a, long long b) {
    return a / __gcd(a, b) * b;
}
//extended euclidean algorithm
long long gcd(long long a, long long b, long long& x, long long& y) {
    x = 1, y = 0;
    long long x1 = 0, y1 = 1, a1 = a, b1 = b;
    while (b1) {
        long long q = a1 / b1;
        tie(x, x1) = make_tuple(x1, x - q * x1);
        tie(y, y1) = make_tuple(y1, y - q * y1);
        tie(a1, b1) = make_tuple(b1, a1 - q * b1);
    }
    return a1;
}
// n-th and (n+1)-th Fibonacci numbers
pair<long long, long long> fib (long long n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    long long c = p.first * (2 * p.second - p.first);
    long long d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

//dfs
/*
void dfs(int v ) {
    visited[v] = true;
    for (int i = 0; i < (int) G [ v ].size(); i++ ) {
    	int u = G [ v ] [ i ];
        if (!visited[u])
            dfs(u);
    }
}
*/

//bfs
/*




*/


/* Function to check if x is power of 2*/
bool isPowerOfTwo (long long x) 
{ 
  /* First x in the below expression is  
    for the case when x is 0 */
  return x && (!(x&(x-1))); 
} 

long long mostSignificantDigit(long long N ) {
	long double K = log10(N);
	K = K - floor(K);
	long long X = pow(10, K);
	return X;
}
long long numberOfDigits(long long N ) {
	N = floor(log10(N)) + 1;
	return N;
}