#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 1e5 + 5;
int n, a[N], xyx, q[N], pos, c[N], p[N];
vector<int> v[N];
inline void get_v(int pos) {
  v[pos].clear();
  if (pos == 1) return;
  if (a[pos] == a[pos - 1]) v[pos].push_back(2);
  for (auto x : v[pos - 1])
    if (a[pos] == a[pos - x - 1]) v[pos].push_back(x + 2);
}
inline bool check_even_pal(int L, int R) {
  assert(R <= pos);
  for (auto x : v[R])
    if (x == R - L + 1) return 1;
  return 0;
}
inline int qry() {
  int res = xyx + c[pos], cur = pos;
  while (p[cur] && q[pos] <= cur - p[cur] / 2) {
    cur -= p[cur] / 2;
    ++res;
  }
  return res;
}
int main() {
  n = read();
  q[0] = 1;
  for (int i = (1); i <= (n); ++i) {
    a[++pos] = read();
    get_v(pos);
    int x;
    if (v[pos].size() &&
        (x = v[pos][0], check_even_pal(pos - x / 2 - x + 1, pos - x / 2))) {
      pos -= x;
      xyx += 2;
    } else {
      p[pos] = v[pos].size() ? v[pos][0] : 0;
      q[pos] = q[pos - 1];
      c[pos] = c[pos - 1];
      if (check_even_pal(q[pos], pos)) {
        q[pos] += (pos - q[pos] + 1) / 2;
        c[pos]++;
      }
    }
    printf("%d%c", qry(), " \n"[i == n]);
  }
  return 0;
}
