#include <bits/stdc++.h>   using namespace std;   int a[100000 + 5], nxt[100000 + 5], lst[100000 + 5], fi[100000 + 5];   int cnt, root[100000 + 5];   struct node {     int sum, ls, rs;   } t[100000 * 43 + 5];   int build(int l, int r) {     int id = ++cnt;     if (l == r) {       t[id].sum = fi[l];       return id;     }     int mid = (l + r) >> 1;     t[id].ls = build(l, mid);     t[id].rs = build(mid + 1, r);     t[id].sum = t[t[id].ls].sum + t[t[id].rs].sum;     return id;   }   void upd(int l, int r, int &x, int y, int p, int v) {     t[x = ++cnt] = t[y];     if (l == r) {       t[x].sum = v;       return;     }     int mid = (l + r) >> 1;     if (p <= mid)       upd(l, mid, t[x].ls, t[y].ls, p, v);     else       upd(mid + 1, r, t[x].rs, t[y].rs, p, v);     t[x].sum = t[t[x].ls].sum + t[t[x].rs].sum;   }   int bs(int l, int r, int x, int v) {     if (v >= t[x].sum) return r + 1;     if (l == r) return l;     int mid = (l + r) >> 1;     if (t[t[x].ls].sum <= v)       return bs(mid + 1, r, t[x].rs, v - t[t[x].ls].sum);     else       return bs(l, mid, t[x].ls, v);   }   int ans[100000 + 5];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= n; i++) fi[i] = 1;     for (int i = n; i >= 1; i--)       nxt[i] = lst[a[i]], lst[a[i]] = i, fi[nxt[i]] = 0;     root[1] = build(1, n);     for (int i = 1; i <= n - 1; i++) {       int tmp = 0;       upd(1, n, tmp, root[i], i, 0);       if (nxt[i])         upd(1, n, root[i + 1], tmp, nxt[i], 1);       else         root[i + 1] = tmp;     }     for (int k = 1; k <= n; k++) {       int now = 1;       while (now <= n) {         ans[k]++;         now = bs(1, n, root[now], k);       }     }     for (int i = 1; i <= n; i++) printf( %d%c , ans[i],    n [i == n]);     return 0;   }   