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
#ifdef _MSC_VER
  #ifndef __GNUC__
    #pragma warning(disable: 4996)
  #endif
  #define main main0
#endif
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long           ll;
typedef unsigned long long ull;
typedef unsigned int      uint;

const ll modulo = 1000000007;
const int MAX_N = /*5;/*/300001;/**/
int n;
int element[MAX_N];
ll liczba[MAX_N];

void Oblicz(int i) {
  ll suma = 0;
  ll liczba0 = liczba[i];
  for( ; i < n; ) {
    suma += element[i];
    ++i;
    if(((suma % modulo) & 1) == 0)
      liczba[i] = (liczba[i] + liczba0) % modulo;
  }
}

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

  cin >> n;
  for(int i = 0; i < n; ++i)
    cin >> element[i];
  fill_n(liczba + 1, n, 0);
  liczba[0] = 1;
  Oblicz(0);
  for(int i = 1; i < n; ++i) {
    if(liczba[i] == 0)
      continue;
    Oblicz(i);
  }

  cout << liczba[n] % modulo << endl;

  return 0;
}