#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	int* table = new int[N+1];
	for(int i = 1; i <= N; i++)scanf("%d",&table[i]);

	priority_queue<int> LEFT,RIGHT;
	queue<int> ANS;

	for(int i = 1; i <= N; i++){
		LEFT.push(table[i]);
		RIGHT.push(table[N+1-i]);

		while(LEFT.empty() == false && RIGHT.empty() == false && LEFT.top() == RIGHT.top()){
			LEFT.pop();
			RIGHT.pop();
		}
		if(LEFT.empty() == true && RIGHT.empty() == true){
			ANS.push(i);
		}
	}

	printf("%d",ANS.front());
	ANS.pop();

	while(!ANS.empty()){
		printf(" %d",ANS.front());
		ANS.pop();
	}
	printf("\n");

	return 0;
}


### Prompt

Develop a solution in cpp to the problem described below:

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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N;
	scanf("%d",&N);

	int* table = new int[N+1];
	for(int i = 1; i <= N; i++)scanf("%d",&table[i]);

	priority_queue<int> LEFT,RIGHT;
	queue<int> ANS;

	for(int i = 1; i <= N; i++){
		LEFT.push(table[i]);
		RIGHT.push(table[N+1-i]);

		while(LEFT.empty() == false && RIGHT.empty() == false && LEFT.top() == RIGHT.top()){
			LEFT.pop();
			RIGHT.pop();
		}
		if(LEFT.empty() == true && RIGHT.empty() == true){
			ANS.push(i);
		}
	}

	printf("%d",ANS.front());
	ANS.pop();

	while(!ANS.empty()){
		printf(" %d",ANS.front());
		ANS.pop();
	}
	printf("\n");

	return 0;
}


```