#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  int cnt = 0;
  vint ans;
  map<int, int> mp;
  rep(i, n) {
    int j = n-1-i;
    bool f = mp[a[i]] == 0;
    mp[a[i]]++;
    if(f) ++cnt;
    else if(mp[a[i]] == 0) --cnt;
    bool g = mp[a[j]] == 0;
    mp[a[j]]--;
    if(g) ++cnt;
    else if(mp[a[j]] == 0) --cnt;
    if(cnt == 0) ans.push_back(i);
    //cout<<i<<" "<<cnt<<endl;
  }
  int sz = ans.size();
  rep(i, sz) cout << ans[i]+1 << " \n"[i==sz-1];

  return 0;
}


### Prompt

Create a solution in CPP for 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 <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  int cnt = 0;
  vint ans;
  map<int, int> mp;
  rep(i, n) {
    int j = n-1-i;
    bool f = mp[a[i]] == 0;
    mp[a[i]]++;
    if(f) ++cnt;
    else if(mp[a[i]] == 0) --cnt;
    bool g = mp[a[j]] == 0;
    mp[a[j]]--;
    if(g) ++cnt;
    else if(mp[a[j]] == 0) --cnt;
    if(cnt == 0) ans.push_back(i);
    //cout<<i<<" "<<cnt<<endl;
  }
  int sz = ans.size();
  rep(i, sz) cout << ans[i]+1 << " \n"[i==sz-1];

  return 0;
}


```