#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64, i64> P;
#define rep(i, s, e) for (int i = (s); i <= (e); i++)

int n;
map<int, int> mp;

int geti(int num) {
  if (!mp.count(num)) {
    int temp = mp.size();
    mp[num] = temp;
    return temp;
  }

  return mp[num];
}

int main() {
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = geti(a[i]);
  }

  vector<int> ans;

  vector<int> cou(mp.size() + 1000, 0);
  int kind = 0;

  for (int i = 0; i < n; i++) {
    {
      if (cou[a[i]] == 0) {
        kind++;
      }
      cou[a[i]]++;
      if (cou[a[i]] == 0) {
        kind--;
      }
    }
    {
      if (cou[a[n - i - 1]] == 0) {
        kind++;
      }
      cou[a[n - i - 1]]--;
      if (cou[a[n - i - 1]] == 0) {
        kind--;
      }
    }

    if (kind == 0) {
      ans.push_back(i + 1);
    }
  }
  if (ans.size() > 0) {
    cout << ans[0];
    for (int i = 1; i < ans.size(); i++) {
      cout << " " << ans[i];
    }
    cout << endl;
  }
}


### Prompt

Your challenge is to write a Cpp solution to the following problem:

problem

Given a sequence $ a_i $ of length $ N $. Output all integers $ K (1 \ le K \ le N) $ that satisfy the following conditions.

Condition: Well sorted $ a_1, \ cdots, a_K $ matches $ a_ {N-K + 1}, \ cdots, a_N $.





Example

Input

8
5 2 4 9 4 9 2 5


Output

1 2 4 6 7 8

### Response

```cpp
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64, i64> P;
#define rep(i, s, e) for (int i = (s); i <= (e); i++)

int n;
map<int, int> mp;

int geti(int num) {
  if (!mp.count(num)) {
    int temp = mp.size();
    mp[num] = temp;
    return temp;
  }

  return mp[num];
}

int main() {
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] = geti(a[i]);
  }

  vector<int> ans;

  vector<int> cou(mp.size() + 1000, 0);
  int kind = 0;

  for (int i = 0; i < n; i++) {
    {
      if (cou[a[i]] == 0) {
        kind++;
      }
      cou[a[i]]++;
      if (cou[a[i]] == 0) {
        kind--;
      }
    }
    {
      if (cou[a[n - i - 1]] == 0) {
        kind++;
      }
      cou[a[n - i - 1]]--;
      if (cou[a[n - i - 1]] == 0) {
        kind--;
      }
    }

    if (kind == 0) {
      ans.push_back(i + 1);
    }
  }
  if (ans.size() > 0) {
    cout << ans[0];
    for (int i = 1; i < ans.size(); i++) {
      cout << " " << ans[i];
    }
    cout << endl;
  }
}


```