#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,0,N) cin >> a[i];
    map<int,int> mpl,mpr;
    vector<int> ans;

    for(int l = 0; l < N; l++){
        int r = (N - 1) - l;
        if(mpr.find(a[l]) != mpr.end()){
            if(mpr[a[l]] == 1) mpr.erase(a[l]);
            else mpr[a[l]]--;
        }else{
            mpl[a[l]]++;
        }
        if(mpl.find(a[r]) != mpl.end() ) {
            if(mpl[a[r]] == 1) mpl.erase(a[r]);
            else mpl[a[r]]--;
        }else{
            mpr[a[r]]++;
        }
        if(mpr.empty() && mpl.empty()){
//            cout << l + 1 << " ";
            ans.push_back(l+1);
        }

    }
    rep(i,0,ans.size()){
        cout << ans[i];
        if(i != ans.size() - 1){
            cout << " ";
        }else{
            cout << endl;
        }
    }


    return 0;
}


### Prompt

Please create a solution in cpp 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 <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,0,N) cin >> a[i];
    map<int,int> mpl,mpr;
    vector<int> ans;

    for(int l = 0; l < N; l++){
        int r = (N - 1) - l;
        if(mpr.find(a[l]) != mpr.end()){
            if(mpr[a[l]] == 1) mpr.erase(a[l]);
            else mpr[a[l]]--;
        }else{
            mpl[a[l]]++;
        }
        if(mpl.find(a[r]) != mpl.end() ) {
            if(mpl[a[r]] == 1) mpl.erase(a[r]);
            else mpl[a[r]]--;
        }else{
            mpr[a[r]]++;
        }
        if(mpr.empty() && mpl.empty()){
//            cout << l + 1 << " ";
            ans.push_back(l+1);
        }

    }
    rep(i,0,ans.size()){
        cout << ans[i];
        if(i != ans.size() - 1){
            cout << " ";
        }else{
            cout << endl;
        }
    }


    return 0;
}


```