#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll HASHMOD = 99999988898898889;
ll p = 35027;
ll ANSMOD = 1000000007;
ll m;
vector<ll> arr;
unordered_set<ll> seen;
void Load() {
  scanf("%lld", &m);
  arr.resize(m);
  for (ll i = 0; i < m; ++i) {
    scanf("%lld", &arr[i]);
    arr[i]++;
  }
  seen.reserve(1024);
  seen.max_load_factor(0.25);
}
void Solve() {
  ll cur_ans = 0;
  for (int r = 0; r < m; ++r) {
    ll hash = 0;
    vector<ll> numseq(m, 0);
    for (int l = r; l >= 0; --l) {
      hash = (hash * p + arr[l]) % HASHMOD;
      ll numseq_this_hash = 0;
      if (l >= r - 2) numseq_this_hash++;
      if (l == r - 3) {
        ll code = 8 * (arr[l] - 1) + 4 * (arr[l + 1] - 1) +
                  2 * (arr[l + 2] - 1) + arr[l + 3] - 1;
        if (code != 3 && code != 5 && code != 14 && code != 15) {
          numseq_this_hash++;
        }
      }
      for (int chars_newest_letter = 1; chars_newest_letter <= 4;
           chars_newest_letter++) {
        if (l + chars_newest_letter > r) continue;
        if (chars_newest_letter <= 3) {
          numseq_this_hash =
              (numseq_this_hash + numseq[l + chars_newest_letter]) % ANSMOD;
        } else {
          ll code = 8 * (arr[l] - 1) + 4 * (arr[l + 1] - 1) +
                    2 * (arr[l + 2] - 1) + arr[l + 3] - 1;
          if (code != 3 && code != 5 && code != 14 && code != 15) {
            numseq_this_hash =
                (numseq_this_hash + numseq[l + chars_newest_letter]) % ANSMOD;
          }
        }
      }
      numseq[l] = numseq_this_hash;
      if (seen.count(hash) == 0) {
        seen.insert(hash);
        cur_ans = (cur_ans + numseq_this_hash) % ANSMOD;
      }
    }
    printf("%lld\n", cur_ans);
  }
}
int main() {
  Load();
  Solve();
}
