#include <bits/stdc++.h>
using namespace std;
using ai = int[102333];
using vi = vector<int>;
ai a, q, c, p;
vi v[102333];
int main() {
  int n, S = 0, i = 0;
  scanf("%d", &n);
  q[0] = 1;
  for (int _ = 1; _ <= n; ++_) {
    ++i;
    scanf("%d", a + i);
    v[i].clear();
    if (i > 1) {
      if (a[i] == a[i - 1]) v[i].push_back(2);
      for (int x : v[i - 1])
        if (a[i] == a[i - x - 1]) v[i].push_back(x + 2);
    }
    auto is_pal = [](int L, int R) {
      for (int x : v[R])
        if (x == R - L + 1) return true;
      return false;
    };
    int x = v[i].size() ? v[i][0] : 0;
    if (v[i].size() && is_pal(i - x / 2 - x + 1, i - x / 2))
      i -= x, S += 2;
    else {
      p[i] = x;
      q[i] = q[i - 1], c[i] = c[i - 1];
      if (is_pal(q[i], i)) q[i] += (i - q[i] + 1) / 2, ++c[i];
    }
    int res = S + c[i];
    int cur = i;
    while (p[cur] && q[i] <= cur - p[cur] / 2) cur -= p[cur] / 2, ++res;
    printf("%d%c", res, " \n"[_ == n]);
  }
  return 0;
}
