#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

int a[100005];
vector<int> ans;

int main(void){
	map<int, int> m;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}
	for (int i = 0; i < N; i++){
		m[a[i]]++;
		m[a[N-1-i]]--;
		if (!m[a[i]]) m.erase(a[i]);
		if (!m[a[N-1-i]]) m.erase(a[N-1-i]);
		if (m.empty()) ans.push_back(i+1);
	}

	for (size_t i = 0; i < ans.size(); i++){
		if (i) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;

}



### Prompt

Create a solution in Cpp for 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 <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

int a[100005];
vector<int> ans;

int main(void){
	map<int, int> m;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		cin >> a[i];
	}
	for (int i = 0; i < N; i++){
		m[a[i]]++;
		m[a[N-1-i]]--;
		if (!m[a[i]]) m.erase(a[i]);
		if (!m[a[N-1-i]]) m.erase(a[N-1-i]);
		if (m.empty()) ans.push_back(i+1);
	}

	for (size_t i = 0; i < ans.size(); i++){
		if (i) cout << " ";
		cout << ans[i];
	}
	cout << endl;
	return 0;

}



```