#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f == 1 ? x : -x;
}
const int N = 1e5 + 4;
int n, top, xyx, ans, a[N], f[N], c[N];
vector<int> vec[N];
inline bool find(int x, int y) {
  for (auto v : vec[x])
    if (v == y) return 1;
  return 0;
}
int main() {
  n = read();
  for (int tt = 1, x; tt <= n; tt++) {
    a[++top] = read();
    vec[top].clear();
    if (top > 1) {
      if (a[top] == a[top - 1]) vec[top].push_back(1);
      for (auto v : vec[top - 1])
        if (a[top - v * 2 - 1] == a[top]) vec[top].push_back(v + 1);
    }
    if (!vec[top].empty() && find(top - vec[top][0], vec[top][0])) {
      top -= vec[top][0] * 2;
      xyx += 2;
    } else {
      f[top] = f[top - 1];
      c[top] = c[top - 1];
      if (!((top - f[top]) & 1) && find(top, (top - f[top]) / 2)) {
        f[top] += (top - f[top]) / 2;
        c[top]++;
      }
    }
    ans = xyx + c[top];
    x = top;
    while (!vec[x].empty() && x - vec[x][0] > f[top]) {
      x -= vec[x][0];
      ans++;
    }
    cout << ans << " ";
  }
  return (0 - 0);
}
