#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();

    map<int, int> mp;
    int cnt = 0;
    VI ans;
    REP(i,n){
        int x = a[i], y = a[n-1-i];
        if (x != y){
            if (mp[x] == 0) cnt++;
            if (mp[x] == -1) cnt--;
            mp[x]++;

            if (mp[y] == 0) cnt++;
            if (mp[y] == 1) cnt--;
            mp[y]--;
        }
        if (cnt == 0) ans.push_back(i + 1);
    }

    REP(i,ans.size()){
        if (i > 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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 <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <assert.h>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();

    map<int, int> mp;
    int cnt = 0;
    VI ans;
    REP(i,n){
        int x = a[i], y = a[n-1-i];
        if (x != y){
            if (mp[x] == 0) cnt++;
            if (mp[x] == -1) cnt--;
            mp[x]++;

            if (mp[y] == 0) cnt++;
            if (mp[y] == 1) cnt--;
            mp[y]--;
        }
        if (cnt == 0) ans.push_back(i + 1);
    }

    REP(i,ans.size()){
        if (i > 0) cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

```