#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

map<int,int> fr;
int kr;
void add(int x,int p){
  int old=fr[x];
  fr[x]=old+p;
  kr+=abs(fr[x])-abs(old);
}

int main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  vi ans;
  rep(i,n){
    add(a[i],1);
    add(a[n-1-i],-1);
    if(kr==0)ans.push_back(i+1);
  }
  rep(i,ans.size()){
    cout<<ans[i]<<(i==(int)ans.size()-1?"\n":" ");
  }
}


### 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<algorithm>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

map<int,int> fr;
int kr;
void add(int x,int p){
  int old=fr[x];
  fr[x]=old+p;
  kr+=abs(fr[x])-abs(old);
}

int main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  vi ans;
  rep(i,n){
    add(a[i],1);
    add(a[n-1-i],-1);
    if(kr==0)ans.push_back(i+1);
  }
  rep(i,ans.size()){
    cout<<ans[i]<<(i==(int)ans.size()-1?"\n":" ");
  }
}


```