#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N;
std::vector<LL>a, ans;
std::map<LL, LL>cou1, cou2;

int main()
{
	in >> N;
	a.resize(N);
	rep(i, N) in >> a[i];
	LL diff = 0;
	rep(i, N)
	{
		if (cou1[a[i]] == cou2[a[i]]) --diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) --diff;
		++cou1[a[i]]; ++cou2[a[N - i - 1]];
		if (cou1[a[i]] == cou2[a[i]]) ++diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) ++diff;
		if (diff == 0) ans.push_back(i + 1);
	}
	rep(i, ans.size() - 1) out << ans[i] << " "; out << ans[ans.size() - 1] << std::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 "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL N;
std::vector<LL>a, ans;
std::map<LL, LL>cou1, cou2;

int main()
{
	in >> N;
	a.resize(N);
	rep(i, N) in >> a[i];
	LL diff = 0;
	rep(i, N)
	{
		if (cou1[a[i]] == cou2[a[i]]) --diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) --diff;
		++cou1[a[i]]; ++cou2[a[N - i - 1]];
		if (cou1[a[i]] == cou2[a[i]]) ++diff;
		if (cou1[a[N - i - 1]] == cou2[a[N - i - 1]]) ++diff;
		if (diff == 0) ans.push_back(i + 1);
	}
	rep(i, ans.size() - 1) out << ans[i] << " "; out << ans[ans.size() - 1] << std::endl;
	return 0;
}

```