#include <bits/stdc++.h>
using namespace std;
int a[4005];
long long dp[4005];
int s[4005];
long long md = 1000000007;
void cal(int len) {
  dp[len + 1] = 1;
  for (int i = len; i >= 1; i--) {
    dp[i] = 0;
    int ns = 0;
    for (int j = i; j <= i + 3 && j <= len; j++) {
      ns = ns * 2 + s[j];
      if ((j != i + 3) || (ns != 3 && ns != 5 && ns != 14 && ns != 15))
        dp[i] += dp[j + 1], dp[i] %= 1000000007;
    }
  }
  return;
}
int ch[4005 * 4005][2];
int rt = 1;
int cnt = 2;
unordered_map<long long, int> hv;
int main() {
  md *= (1000000007 + 2);
  int t;
  cin >> t;
  for (int i = 1; i <= t; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 1; i <= t; i++) {
    int ls = 0;
    int npl = rt;
    for (int j = i; j >= 1; j--) {
      if (!ch[npl][a[j]]) ch[npl][a[j]] = cnt++, ls = max(ls, j);
      npl = ch[npl][a[j]];
    }
    for (int j = 1; j <= i; j++) s[j] = a[j];
    cal(i);
    for (int j = 1; j <= ls; j++) ans += dp[j], ans %= 1000000007;
    cout << ans << endl;
  }
  return 0;
}
