#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 3e3 + 5;
long long dp[maxn * maxn];
int tot = 0;
int nxt[maxn * maxn][2];
int par[maxn * maxn];
int ed[maxn], val[maxn * maxn];
bool check(int p) {
  if (p == 12 || p == 10 || p == 7 || p == 15) return false;
  return true;
}
long long ans = 0;
long long insert(int v, int id) {
  for (int i = 1; i <= id; i++) {
    if (nxt[ed[i]][v] == -1)
      nxt[ed[i]][v] = ++tot, par[tot] = ed[i], val[tot] = v;
    ed[i] = nxt[ed[i]][v];
  }
  for (int i = 1; i <= id; i++) {
    int u = par[ed[i]];
    ans -= dp[ed[i]];
    ans = (ans + mod) % mod;
    dp[ed[i]] = 0;
    int p = v;
    for (int j = 1; j <= 4; j++) {
      if (j == 4 && !check(p)) break;
      dp[ed[i]] += dp[u];
      p = (p << 1) + val[u];
      if (u == 0) break;
      u = par[u];
    }
    dp[ed[i]] %= mod;
    ans += dp[ed[i]];
    ans %= mod;
  }
  return ans;
}
int m, x;
int main() {
  memset(nxt, -1, sizeof(nxt));
  dp[0] = 1;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) ed[i] = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    printf("%lld\n", insert(x, i));
  }
  return 0;
}
