#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
const int maxn = 5000010;
int n, ct, res;
struct node {
  int f;
  node *ch[2], *fa;
  int wh() { return (this == fa->ch[0] ? 0 : 1); }
} po[maxn], *root, *null;
node *get(int f = -1) {
  po[++ct].f = f;
  po[ct].ch[0] = po[ct].ch[1] = po[ct].fa = null;
  return &po[ct];
}
int ca, cb;
node *lA[maxn], *lB[maxn];
node **la, **lb;
void add(int x) {
  cb = 0, lb[++cb] = root;
  for (int i = 1; i <= ca; i++) {
    node *now = la[i];
    if (now->ch[x] == null) {
      now->ch[x] = get();
      now->ch[x]->fa = now;
    }
    lb[++cb] = now->ch[x];
  }
  swap(la, lb);
  swap(ca, cb);
}
bool ok(char *s) {
  if (!strcmp(s, "1100") || !strcmp(s, "1010") || !strcmp(s, "0111") ||
      !strcmp(s, "1111"))
    return false;
  return true;
}
void calc() {
  for (int i = 1; i <= ca; i++) {
    if (la[i]->f != -1) continue;
    la[i]->f = 0;
    int ss = 0;
    char s[6];
    s[ss++] = '0' + la[i]->wh();
    s[ss] = '\0';
    for (node *now = la[i]->fa; ss <= 4 && ok(s) && now != null;
         now = now->fa) {
      la[i]->f = (la[i]->f + now->f) % p;
      s[ss++] = '0' + now->wh();
      s[ss] = '\0';
    }
    res = (res + la[i]->f) % p;
  }
}
int main() {
  la = lA, lb = lB;
  null = po;
  null->ch[0] = null->ch[1] = null->fa = null;
  root = get(1);
  la[++ca] = root;
  scanf("%d", &n);
  for (int i = 1, t; i <= n; i++) {
    scanf("%d", &t);
    add(t);
    calc();
    printf("%d\n", res);
  }
  return 0;
}
