#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100001];
vector<int> vec;
int cnt[100001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		vec.push_back(a[i]);
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(),vec.end()),vec.end());
	for(int i=0;i<n;i++){
		a[i]=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
	}
	int now=0;
	bool po=false;
	for(int i=0;i<n;i++){
		cnt[a[i]]++;
		if(cnt[a[i]]==1)now++;
		if(cnt[a[i]]==0)now--;
		cnt[a[n-1-i]]--;
		if(cnt[a[n-1-i]]==-1)now++;
		if(cnt[a[n-1-i]]==0)now--;
		if(now==0){
			if(po)printf(" ");
			po=true;
			printf("%d",i+1);
		}
	}
	printf("\n");
	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>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100001];
vector<int> vec;
int cnt[100001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		vec.push_back(a[i]);
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(),vec.end()),vec.end());
	for(int i=0;i<n;i++){
		a[i]=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
	}
	int now=0;
	bool po=false;
	for(int i=0;i<n;i++){
		cnt[a[i]]++;
		if(cnt[a[i]]==1)now++;
		if(cnt[a[i]]==0)now--;
		cnt[a[n-1-i]]--;
		if(cnt[a[n-1-i]]==-1)now++;
		if(cnt[a[n-1-i]]==0)now--;
		if(now==0){
			if(po)printf(" ");
			po=true;
			printf("%d",i+1);
		}
	}
	printf("\n");
	return 0;
}

```