#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
ll a[101010];
map<ll,ll> pre,suf;
ll d=0;
vector<ll> res;

int main(){
  cin>>n;
  rep(i,n)cin>>a[i];
  rep(i,(n/2)){
    d-=abs(pre[a[i]]-suf[a[i]]);
    pre[a[i]]++;
    d+=abs(pre[a[i]]-suf[a[i]]);

    d-=abs(pre[a[n-1-i]]-suf[a[n-1-i]]);
    suf[a[n-1-i]]++;
    d+=abs(pre[a[n-1-i]]-suf[a[n-1-i]]);
    if(d==0){
      res.push_back(i+1);
      if(i+1!=n-1-i)res.push_back(n-1-i);
    }
  }
  res.push_back(n);
  sort(all(res));
  uni(res);
  cout<<res[0];
  repl(i,1,res.size())cout<<" "<<res[i];
  cout<<endl;
  return 0;
}



### 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 unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n;
ll a[101010];
map<ll,ll> pre,suf;
ll d=0;
vector<ll> res;

int main(){
  cin>>n;
  rep(i,n)cin>>a[i];
  rep(i,(n/2)){
    d-=abs(pre[a[i]]-suf[a[i]]);
    pre[a[i]]++;
    d+=abs(pre[a[i]]-suf[a[i]]);

    d-=abs(pre[a[n-1-i]]-suf[a[n-1-i]]);
    suf[a[n-1-i]]++;
    d+=abs(pre[a[n-1-i]]-suf[a[n-1-i]]);
    if(d==0){
      res.push_back(i+1);
      if(i+1!=n-1-i)res.push_back(n-1-i);
    }
  }
  res.push_back(n);
  sort(all(res));
  uni(res);
  cout<<res[0];
  repl(i,1,res.size())cout<<" "<<res[i];
  cout<<endl;
  return 0;
}



```