#include <bits/stdc++.h>
using namespace std;
const int maxn = 9000000 + 233;
const int T = 1e9 + 7;
int ch[maxn][2], f[maxn], p[maxn];
int fib[100], a[5000], cnt = 0;
int ans = 0;
inline int w(int x) {
  if (ch[p[x]][0] == x) return 0;
  return 1;
}
inline int cal(int x) {
  if (f[x] != -1) return f[x];
  f[x] = 0;
  int y = x, cur = 0;
  for (int i = 1; i <= 4; i++) {
    cur = cur * 2 + w(y);
    y = p[y];
    if (i == 4 && fib[cur]) continue;
    f[x] = (f[x] + f[y]) % T;
    if (!y) return f[x];
  }
  return f[x];
}
int main() {
  fib[3] = fib[5] = fib[14] = fib[15] = 1;
  int n;
  cin >> n;
  memset(ch, -1, sizeof(ch));
  memset(f, -1, sizeof(f));
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    int cur = 0;
    for (int j = i; j; j--) {
      if (ch[cur][a[j]] == -1) {
        ch[cur][a[j]] = ++cnt;
        p[cnt] = cur;
        ans = (ans + cal(cnt)) % T;
      }
      cur = ch[cur][a[j]];
    }
    printf("%d\n", ans);
  }
  return 0;
}
