#include <bits/stdc++.h>
using namespace std;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
int n;
int a[MAXN];
int ans[MAXN];
int b[MAXN], nb;
vector<int> palsuffixes[MAXN];
int shortestpal[MAXN];
vector<int> shortestpalends[MAXN];
void solve() {
  nb = 0;
  int sofar = 0;
  for (int i = (0); i < (n); ++i) {
    int x = a[i];
    if (nb - 1 >= 0) {
      for (int j = (0); j < (((int)(palsuffixes[nb - 1]).size())); ++j) {
        int plen = palsuffixes[nb - 1][j];
        if (nb - plen - 1 >= 0 && b[nb - plen - 1] == x)
          palsuffixes[nb].push_back(plen + 2);
      }
      if (b[nb - 1] == x) palsuffixes[nb].push_back(2);
    }
    b[nb++] = x;
    shortestpal[nb - 1] = -1;
    for (int j = (0); j < (((int)(palsuffixes[nb - 1]).size())); ++j) {
      int len = palsuffixes[nb - 1][j];
      if (shortestpal[nb - len] == -1)
        shortestpal[nb - len] = len,
                         shortestpalends[nb - 1].push_back(nb - len);
    }
    if (((int)(palsuffixes[nb - 1]).size()) >= 1) {
      int mnlen = palsuffixes[nb - 1].back();
      int pidx = nb - mnlen / 2 - 1;
      bool found = false;
      for (int j = (0); j < (((int)(palsuffixes[pidx]).size())); ++j)
        if (palsuffixes[pidx][j] == mnlen) found = true;
      if (found) {
        sofar += 2;
        for (int j = (0); j < (mnlen); ++j) {
          --nb;
          palsuffixes[nb].clear();
          for (int k = (0); k < (((int)(shortestpalends[nb]).size())); ++k) {
            int idx = shortestpalends[nb][k];
            assert(shortestpal[idx] == nb - idx + 1);
            shortestpal[idx] = -1;
          }
          shortestpalends[nb].clear();
        }
      }
    }
    ans[i] = sofar;
    int prefrem = 0;
    {
      int at = 0;
      while (shortestpal[at] != -1)
        ++ans[i], prefrem += shortestpal[at] / 2, at += shortestpal[at] / 2;
    }
    {
      int at = nb - 1;
      while (((int)(palsuffixes[at]).size()) >= 1) {
        int len = palsuffixes[at].back();
        if (at + 1 - prefrem < len) break;
        ++ans[i], at -= len / 2;
      }
    }
  }
}
void run() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  solve();
  for (int i = (0); i < (n); ++i) {
    if (i != 0) printf(" ");
    printf("%d", ans[i]);
  }
  puts("");
}
int main() {
  run();
  return 0;
}
