#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
signed main(){
    int n; cin >> n;
    vector<int>v(n);
    rep(i,n) cin >> v[i];
    vector<int>ans;
    map<int,int>s;
    map<int, int>t;
    string a,b;
    rep(i,n){
        s[v[i]]++;
        t[v[n-i-1]]++;
          if(s == t)ans.push_back(i);
        
    }
    if(ans.size()){
        rep(i,ans.size()){
            if(i){
                cout << " ";
            }
            cout << ans[i]+1;
        }
    }else{
        cout << 0;
    }
    cout<<endl;
}


### Prompt

Please create a solution in CPP 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<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
int W,H;
bool inrange(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define MP make_pair
signed main(){
    int n; cin >> n;
    vector<int>v(n);
    rep(i,n) cin >> v[i];
    vector<int>ans;
    map<int,int>s;
    map<int, int>t;
    string a,b;
    rep(i,n){
        s[v[i]]++;
        t[v[n-i-1]]++;
          if(s == t)ans.push_back(i);
        
    }
    if(ans.size()){
        rep(i,ans.size()){
            if(i){
                cout << " ";
            }
            cout << ans[i]+1;
        }
    }else{
        cout << 0;
    }
    cout<<endl;
}


```