#include <bits/stdc++.h>
using namespace std;
static int n, m, seq[3000 + 10];
static int fa[((3000 * (3000 + 1)) / 2) + 10],
    ch[((3000 * (3000 + 1)) / 2) + 10][2];
static long long dp[((3000 * (3000 + 1)) / 2) + 10], ans;
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000007LL) a -= 1000000007LL;
}
inline void update(int x) {
  int p = x, cur = 0, i = 0;
  do {
    cur = (cur << 1) | (ch[fa[p]][1] == p);
    p = fa[p];
    i++;
    if (i < 4 || (cur != 12 && cur != 10 && cur != 7 && cur != 15))
      add(dp[x], dp[p]);
  } while (p && i < 4);
  add(ans, dp[x]);
}
int main() {
  int q;
  scanf("%d", &q);
  dp[0] = 1;
  while (q--) {
    int c;
    scanf("%d", &c);
    n++;
    for (int i = 0; i < n; i++) {
      int x = seq[i];
      if (!ch[x][c]) {
        fa[++m] = x;
        ch[x][c] = m;
        update(m);
      }
      seq[i] = ch[x][c];
    }
    printf("%lld\n", ans);
  }
  return 0;
}
