#include <bits/stdc++.h>
using std::string;
long long f[3005][3005];
int vis[3005][3005];
int good[3005][30];
int a[3005];
int len[30];
string ban[4] = {"0011", "0101", "1110", "1111"};
string letter[30];
const long long mod = 1e9 + 7;
std::vector<string> set;
void preWork(int n) {
  int total = 0;
  for (int i = 1; i <= 4; i++) {
    for (int j = 0; j < (1 << i); j++) {
      int mask = j;
      string u = "";
      for (int k = 0; k < i; k++) {
        u.push_back(mask % 2 + '0');
        mask /= 2;
      }
      int find = 0;
      for (int k = 0; k < 4; k++)
        if (ban[k] == u) find = 1;
      if (!find) {
        ++total;
        len[total] = u.size();
        letter[total] = u;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 4 && j <= i; j++) {
      string u = "";
      for (int k = 0; k < j; k++) {
        int p = i - j + 1 + k;
        u.push_back(a[p] + '0');
      }
      for (int k = 1; k <= 26; k++)
        if (u == letter[k]) good[i][k] = 1;
    }
  }
}
void dp(int l, int r) {
  vis[l][r] = 1;
  f[l][r] = 0;
  if (l == r + 1)
    f[l][r] = 1;
  else {
    for (int i = 1; i <= 26; i++) {
      if (good[r][i] && r - len[i] + 1 >= l) {
        int m = r - len[i];
        if (!vis[l][m]) dp(l, m);
        f[l][r] += f[l][m];
        if (f[l][r] >= mod) f[l][r] -= mod;
      }
    }
  }
}
int isInSet(string u) {
  for (string s : set) {
    if (s == u) return 1;
  }
  return 0;
}
int b[3005];
struct Trie {
  int l, r;
  Trie() { l = r = -1; }
};
Trie t[9000005];
int Global = -1;
int doInsert(int u, int p, int size) {
  int tag = -1;
  if (b[p] == 0) {
    if (t[u].l == -1) {
      tag = p;
      t[u].l = ++Global;
      if (p + 1 <= size) doInsert(t[u].l, p + 1, size);
    } else {
      if (p + 1 <= size) tag = doInsert(t[u].l, p + 1, size);
    }
  } else {
    if (t[u].r == -1) {
      tag = p;
      t[u].r = ++Global;
      if (p + 1 <= size) doInsert(t[u].r, p + 1, size);
    } else {
      if (p + 1 <= size) tag = doInsert(t[u].r, p + 1, size);
    }
  }
  return tag;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  preWork(n);
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++)
      if (!vis[i][j]) dp(i, j);
  }
  Global = 0;
  int root = ++Global;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    int size = 0;
    for (int j = i; j >= 1; j--) b[++size] = a[j];
    int res = doInsert(root, 1, size);
    if (res != -1) {
      int p = i - res + 1;
      for (int j = 1; j <= p; j++) {
        ans += f[j][i];
        if (ans >= mod) ans -= mod;
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
