#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  int testNum = 1;
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
template <typename T>
void make_unique(vector<T>& a) {
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
void precalc() {}
const int mod = 1000000007;
struct Node {
  int to[2];
  int min_end;
  Node() {
    to[0] = to[1] = -1;
    min_end = 0;
  }
};
vector<Node> nodes;
const int C = 3010;
int dp[C][C];
void add(int& cur, int val) { cur = (cur + val) % mod; }
void solve(__attribute__((unused)) bool read) {
  nodes.push_back(Node());
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<char> cant(n, false);
  set<string> no_way;
  no_way.insert("0011");
  no_way.insert("0101");
  no_way.insert("1110");
  no_way.insert("1111");
  for (int i = 0; i + 4 <= n; ++i) {
    string cur;
    for (int j = i; j < i + 4; ++j) {
      cur += (char)('0' + a[j]);
    }
    if (no_way.count(cur)) {
      cant[i] = true;
    }
  }
  int res = 0;
  for (int pref = 0; pref < n; ++pref) {
    dp[pref][pref] = 1;
    int v = 0;
    for (int j = pref; j >= 0; --j) {
      if (nodes[v].to[a[j]] == -1) {
        nodes[v].to[a[j]] = nodes.size();
        nodes.push_back(Node());
        nodes.back().min_end = j;
        dp[j][pref + 1] = 0;
        for (int len = 1; len <= 4 && len <= pref - j + 1; ++len) {
          if (len == 4 && cant[pref - len + 1]) {
            continue;
          }
          add(dp[j][pref + 1], dp[j][pref + 1 - len]);
        }
        add(res, dp[j][pref + 1]);
      }
      v = nodes[v].to[a[j]];
      int l = nodes[v].min_end;
      int r = l + (pref + 1 - j);
      dp[j][pref + 1] = dp[l][r];
    }
    cout << res << "\n";
  }
}
