#include <bits/stdc++.h>
const int INF = 1000 * 1000 * 1000;
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
int de[3005];
int dp[5000000];
int sons[5000000][2];
int p[5000000];
int zer(int u) { return sons[p[u]][0] == u; }
int ans = 0;
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
void recalc(int u) {
  int mask = 0;
  int v = u;
  for (int sz = 1; sz <= 4; sz++) {
    if (p[v] == -1) {
      return;
    }
    mask |= (!zer(v)) << (sz - 1);
    v = p[v];
    if (sz == 4) {
      if (mask == 3 || mask == 5 || mask == 14 || mask == 15) return;
    }
    dp[u] = add(dp[u], dp[v]);
  }
}
int main() {
  int m;
  cin >> m;
  p[0] = -1;
  memset(sons, -1, sizeof sons);
  int ptr = 1;
  dp[0] = 1;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    de[i] = 0;
    for (int j = 0; j <= i; j++) {
      if (sons[de[j]][x] == -1) {
        p[ptr] = de[j];
        sons[de[j]][x] = ptr++;
        recalc(ptr - 1);
        ans = add(ans, dp[ptr - 1]);
      }
      de[j] = sons[de[j]][x];
    }
    cout << ans << endl;
  }
}
