#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    
    
    multiset<int> st;
    vector<int> ans;
    rep(k,n){
        if(st.count(-a[k])==0){
            st.insert(a[k]);
        }else{
            st.erase(st.find(-a[k]));
        }

        if(st.count(a[n-k-1])==0){
            st.insert(-a[n-k-1]);
        }else{
            st.erase(st.find(a[n-k-1]));
        }
        
        if(st.size()==0)ans.pb(k);
    }
    rep(i,ans.size()){
        if(i)cout<<" ";
        cout<<ans[i]+1;
    }
    cout<<endl;
}


### Prompt

Construct a Cpp code solution to the problem outlined:

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;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    
    
    multiset<int> st;
    vector<int> ans;
    rep(k,n){
        if(st.count(-a[k])==0){
            st.insert(a[k]);
        }else{
            st.erase(st.find(-a[k]));
        }

        if(st.count(a[n-k-1])==0){
            st.insert(-a[n-k-1]);
        }else{
            st.erase(st.find(a[n-k-1]));
        }
        
        if(st.size()==0)ans.pb(k);
    }
    rep(i,ans.size()){
        if(i)cout<<" ";
        cout<<ans[i]+1;
    }
    cout<<endl;
}


```