#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MOD2 = 1090930879;
vector<int> v;
unordered_set<int> hashes[3001];
int lst;
int dp[3001];
int solve(int in) {
  if (in == -1) return 0;
  int& res = dp[in];
  if (res != -1) return res;
  res = 0;
  int x = 0;
  int p = 1;
  for (int i = 0; i < 4 && in - i >= 0; i++) {
    x += p * v[in - i];
    if (i == 3 && (x == 0b0101 || x == 0b1110 || x == 0b1111 || x == 0b0011))
      continue;
    p *= 2;
    res += solve(in - i - 1);
    if (in - i <= lst) {
      res += 1;
    }
    res %= MOD;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  v.reserve(n);
  int x;
  long long res = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    v.push_back(x);
    long long hsh = 0;
    lst = -1;
    for (int j = i; j >= 0; j--) {
      hsh *= 3;
      hsh += v[j] + 1;
      hsh %= MOD2;
      auto it = hashes[i - j].find(hsh);
      if (it == hashes[i - j].end()) {
        if (lst == -1) lst = j;
        hashes[i - j].insert(hsh);
      }
    }
    memset(dp, -1, (i + 1) * 4);
    res += solve(i);
    res %= MOD;
    printf("%lld\n", res);
  }
  return 0;
}
