#include <iostream>
#include <vector>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)

int main() {
    int n;
    while (cin >> n) {
        map<int, int> cnt;
        vector<int> a(n);
        rep(i, n) cin >> a[i];
        vector<int> ans;
        rep(i, n) {
            int l = a[i], r = a[n - i - 1];
            cnt[l]++;
            cnt[r]--;
            if (cnt[l] == 0) cnt.erase(l);
            if (cnt[r] == 0) cnt.erase(r);
            if (cnt.size() == 0) {
                ans.push_back(i);
            }
        }
        rep(i, ans.size()) {
            cout << ans[i] + 1;
            if (i + 1 == ans.size()) {
                cout << endl;
            } else {
                cout << ' ';
            }
        }
    }
}


### Prompt

Develop a solution in CPP to the problem described below:

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 <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)

int main() {
    int n;
    while (cin >> n) {
        map<int, int> cnt;
        vector<int> a(n);
        rep(i, n) cin >> a[i];
        vector<int> ans;
        rep(i, n) {
            int l = a[i], r = a[n - i - 1];
            cnt[l]++;
            cnt[r]--;
            if (cnt[l] == 0) cnt.erase(l);
            if (cnt[r] == 0) cnt.erase(r);
            if (cnt.size() == 0) {
                ans.push_back(i);
            }
        }
        rep(i, ans.size()) {
            cout << ans[i] + 1;
            if (i + 1 == ans.size()) {
                cout << endl;
            } else {
                cout << ' ';
            }
        }
    }
}


```