#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
	int n, cnt = 0; cin >> n;
	priority_queue<int> l, r;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) {
		l.push(a[i]); r.push(a[n - i - 1]);
		while (!l.empty() && (l.top() == r.top()))
			l.pop(), r.pop();
		if(l.empty()){
			if (cnt++) cout << " ";
			cout << i + 1;
		}
	}
	cout << endl;

	return 0;
}

### 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 <vector>
#include <queue>

using namespace std;

int main() {
	int n, cnt = 0; cin >> n;
	priority_queue<int> l, r;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) {
		l.push(a[i]); r.push(a[n - i - 1]);
		while (!l.empty() && (l.top() == r.top()))
			l.pop(), r.pop();
		if(l.empty()){
			if (cnt++) cout << " ";
			cout << i + 1;
		}
	}
	cout << endl;

	return 0;
}

```