#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, k, w[N];
vector<int> vl[N], vr[N];
unordered_map<int, int> F[N];
inline int dfs(int l, int r) {
  if (F[r].count(l)) return F[r][l];
  int ans = 0;
  for (int i = 0; i < vl[l].size(); i++)
    if (l + vl[l][i] <= r) ans = max(ans, dfs(l + (vl[l][i] + 1) / 2, r) + 1);
  for (int i = 0; i < vr[r].size(); i++)
    if (r - vr[r][i] >= l) ans = max(ans, dfs(l, r - (vr[r][i] + 1) / 2) + 1);
  F[r][l] = ans;
  return ans;
}
int main() {
  cin >> n;
  int x, ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x), w[++k] = x;
    if (w[k] == w[k - 1]) vr[k].push_back(1), vl[k - 1].push_back(1);
    for (int j = 0; j < vr[k - 1].size(); j++) {
      int x = k - 2 - vr[k - 1][j];
      if (w[x] == w[k])
        vl[x].push_back(vr[k - 1][j] + 2), vr[k].push_back(vr[k - 1][j] + 2);
    }
    if (vr[k].size() == 1) {
      int p = k - (vr[k][0] + 1) / 2;
      bool fl = 0;
      for (int j = 0; j < vr[p].size(); j++)
        if (vr[p][j] == vr[k][0]) fl = 1;
      if (fl) {
        p = k - vr[k][0];
        while (k >= p) {
          for (int j = 0; j < vr[k].size(); j++)
            vl[k - vr[k][j]].resize(vl[k - vr[k][j]].size() - 1);
          vr[k].resize(0), F[k].clear(), k--;
        }
        ans += 2;
      }
    }
    printf("%d ", ans + dfs(1, k));
  }
}
