#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 100001;
ll n,a[N],k=0;
priority_queue <ll> ak,an;

int main(){
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
	}
	FOR(i,0,n){
		ak.push(a[i]);
		an.push(a[n-1-i]);
		while(ak.top()==an.top()){
			an.pop();
			ak.pop();
			if(ak.empty())break;
		}
		if(ak.empty()&&an.empty()){
			if(k==0){
				cout<<i+1;
				k++;
			}
			else cout<<" "<<i+1;
		}
	}
	cout<<endl;
	return 0;
}

### Prompt

Generate 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
const ll INF=1e15+7;
const ll N = 100001;
ll n,a[N],k=0;
priority_queue <ll> ak,an;

int main(){
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
	}
	FOR(i,0,n){
		ak.push(a[i]);
		an.push(a[n-1-i]);
		while(ak.top()==an.top()){
			an.pop();
			ak.pop();
			if(ak.empty())break;
		}
		if(ak.empty()&&an.empty()){
			if(k==0){
				cout<<i+1;
				k++;
			}
			else cout<<" "<<i+1;
		}
	}
	cout<<endl;
	return 0;
}

```