func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Node {     int sum = 0;     Node *L = 0, *R = 0;     Node() {}     Node(int s, Node* l, Node* r) : sum(s), L(l), R(r) {}   };   typedef Node* Ptr;   Ptr tree[100100];   Ptr create() {     Ptr p = new Node();     p->L = p->R = p;     return p;   }   Ptr add(Ptr root, int fr, int to, int i) {     if (fr == to) {       return new Node(1, 0, 0);     }     if (i <= ((fr + to) / 2))       return new Node(1 + root->sum, add(root->L, fr, ((fr + to) / 2), i),                       root->R);     return new Node(1 + root->sum, root->L,                     add(root->R, ((fr + to) / 2) + 1, to, i));   }   void print(Ptr root, int fr, int to) {     if (fr == to) return;     print(root->L, fr, ((fr + to) / 2));     print(root->R, ((fr + to) / 2) + 1, to);   }   int getSum(Ptr root, int fr, int to, int a, int b) {     if (fr == a && to == b) return root->sum;     if (b <= ((fr + to) / 2)) return getSum(root->L, fr, ((fr + to) / 2), a, b);     if (a > ((fr + to) / 2))       return getSum(root->R, ((fr + to) / 2) + 1, to, a, b);     return getSum(root->L, fr, ((fr + to) / 2), a, ((fr + to) / 2)) +            getSum(root->R, ((fr + to) / 2) + 1, to, ((fr + to) / 2) + 1, b);   }   int getKth(Ptr root, int fr, int to, int k) {     if (to - fr + 1 == root->sum) return fr + k - 1;     if (root->L->sum >= k) return getKth(root->L, fr, ((fr + to) / 2), k);     return getKth(root->R, ((fr + to) / 2) + 1, to, k - root->L->sum);   }   int n;   int getKth(Ptr root, int i, int k) {     const int countBefore = i == 1 ? 0 : getSum(root, 1, n, 1, i - 1);     k += countBefore;     if (root->sum < k) return n + 1;     return getKth(root, 1, n, k);   }   int solve(int k) {     int i = 1;     int ans = 0;     while (i <= n) {       const int newI = getKth(tree[i - 1], i, k + 1);       i = newI;       ans++;     }     return ans;   }   int color[100100];   int lastSeen[100100];   int prv[100100];   int ans[100100];   vector<int> prvInv[100100];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , color + i);       prv[i] = lastSeen[color[i]];       prvInv[prv[i]].push_back(i);       lastSeen[color[i]] = i;     }     for (int i = 0; i <= n; ++i) {       tree[i] = !i ? create() : tree[i - 1];       for (int j : prvInv[i]) tree[i] = add(tree[i], 1, n, j);     }     for (int k = 1; k <= n; ++k) ans[k] = solve(k);     for (int k = 1; k <= n; ++k) printf( %d%c , ans[k],    n [k == n]);     return 0;   }   