#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<ll> ans;
	vector<ll> b(n);
	REP(i,n) b[i]=a[i];
	sort(ALL(b));
	b.erase(unique(ALL(b)),b.end());
	map<ll,ll> at;
	ll c=0;
	REP(i,b.size()) {
		at[b[i]]=c;
		c++;
	}
	vector<ll> cnt(n+1);
	ll hoge=0;
	REP(i,n) {
		cnt[at[a[i]]]++;
		if(cnt[at[a[i]]]==1) hoge++;
		else if(cnt[at[a[i]]]==0) hoge--;
		cnt[at[a[n-1-i]]]--;
		if(cnt[at[a[n-1-i]]]==-1) hoge++;
		else if(cnt[at[a[n-1-i]]]==0) hoge--;
		if(hoge==0) ans.pb(i+1);
	}
	if((ll)ans.size()==0) cout<<endl;
	else DUMP(ans);
}


### Prompt

Your challenge is to write a CPP solution 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<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<ll> ans;
	vector<ll> b(n);
	REP(i,n) b[i]=a[i];
	sort(ALL(b));
	b.erase(unique(ALL(b)),b.end());
	map<ll,ll> at;
	ll c=0;
	REP(i,b.size()) {
		at[b[i]]=c;
		c++;
	}
	vector<ll> cnt(n+1);
	ll hoge=0;
	REP(i,n) {
		cnt[at[a[i]]]++;
		if(cnt[at[a[i]]]==1) hoge++;
		else if(cnt[at[a[i]]]==0) hoge--;
		cnt[at[a[n-1-i]]]--;
		if(cnt[at[a[n-1-i]]]==-1) hoge++;
		else if(cnt[at[a[n-1-i]]]==0) hoge--;
		if(hoge==0) ans.pb(i+1);
	}
	if((ll)ans.size()==0) cout<<endl;
	else DUMP(ans);
}


```