#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,f=0;
	cin>>n;
	int a[n];
	priority_queue<int>q1,q2;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		q1.push(a[i]);
		q2.push(a[n-i-1]);
		while(!q1.empty()&&q1.top()==q2.top())q1.pop(),q2.pop();
		if(q1.empty()){
			if(f++)cout<<' ';
			cout<<i+1;
		}
	}cout<<endl;
}

### 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;
int main(){
	int n,f=0;
	cin>>n;
	int a[n];
	priority_queue<int>q1,q2;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		q1.push(a[i]);
		q2.push(a[n-i-1]);
		while(!q1.empty()&&q1.top()==q2.top())q1.pop(),q2.pop();
		if(q1.empty()){
			if(f++)cout<<' ';
			cout<<i+1;
		}
	}cout<<endl;
}

```