#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n)cin >> a[i];
	vector<int> ans;
	map<int, int> mp;
	rep(i, n) {
		mp[a[i]]++;
		if (mp[a[i]] == 0)mp.erase(a[i]);
		mp[a[n - i - 1]]--;
		if (mp[a[n - i - 1]] == 0)mp.erase(a[n - i - 1]);
		if (mp.size() == 0)ans.push_back(i + 1);
	}
	int m = ans.size();
	rep(i, m) {
		cout << ans[i];
		if (i != m - 1)cout << " ";
	}
	cout << endl;
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

### Prompt

Generate 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<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)

void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n)cin >> a[i];
	vector<int> ans;
	map<int, int> mp;
	rep(i, n) {
		mp[a[i]]++;
		if (mp[a[i]] == 0)mp.erase(a[i]);
		mp[a[n - i - 1]]--;
		if (mp[a[n - i - 1]] == 0)mp.erase(a[n - i - 1]);
		if (mp.size() == 0)ans.push_back(i + 1);
	}
	int m = ans.size();
	rep(i, m) {
		cout << ans[i];
		if (i != m - 1)cout << " ";
	}
	cout << endl;
	return;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

```