#include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	cin >> N;
	vector<int32> A(N);
	REP(i, N) cin >> A[i];
	map<int32, int32> fr, ba;
	int32 out = 0;
	vector<int32> res;
	REP(i, N){
		if(fr[A[i]] == ba[A[i]]) out++;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out++;
		fr[A[i]]++;
		ba[A[N-i-1]]++;
		if(fr[A[i]] == ba[A[i]]) out--;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out--;
		if(out == 0){
			res.push_back(i+1);
		}
	}
	sort(all(res));
	REP(i, res.size()-1)
		cout << res[i] << " ";
	cout << res[res.size()-1] << endl;
}

### Prompt

In CPP, your task is to solve 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 <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	cin >> N;
	vector<int32> A(N);
	REP(i, N) cin >> A[i];
	map<int32, int32> fr, ba;
	int32 out = 0;
	vector<int32> res;
	REP(i, N){
		if(fr[A[i]] == ba[A[i]]) out++;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out++;
		fr[A[i]]++;
		ba[A[N-i-1]]++;
		if(fr[A[i]] == ba[A[i]]) out--;
		if(fr[A[N-i-1]] == ba[A[N-i-1]]) out--;
		if(out == 0){
			res.push_back(i+1);
		}
	}
	sort(all(res));
	REP(i, res.size()-1)
		cout << res[i] << " ";
	cout << res[res.size()-1] << endl;
}

```