#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  vi vec;
  map<ll,ll> test;
  rep(i,0,n)cin >> d[i];
  rep(i,0,n){
    test[d[i]]++;
    test[d[n-1-i]]--;
    if(test[d[i]] == 0)test.erase(d[i]);
    //cout << "i:" << test.size() << endl;
    if(test[d[n-1-i]] == 0)test.erase(d[n-1-i]);
    //cout << "j:" << test.size() << endl << endl;
    if(test.empty())vec.pb(i);
  }
  sort(all(vec));
  rep(i,0,vec.sz){
    cout << vec[i] + 1;
    if(i == vec.sz-1)break;
    cout <<" ";
  }
  cout << endl;
  return 0;
}

### Prompt

Your task is to create a cpp solution 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 <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  vi vec;
  map<ll,ll> test;
  rep(i,0,n)cin >> d[i];
  rep(i,0,n){
    test[d[i]]++;
    test[d[n-1-i]]--;
    if(test[d[i]] == 0)test.erase(d[i]);
    //cout << "i:" << test.size() << endl;
    if(test[d[n-1-i]] == 0)test.erase(d[n-1-i]);
    //cout << "j:" << test.size() << endl << endl;
    if(test.empty())vec.pb(i);
  }
  sort(all(vec));
  rep(i,0,vec.sz){
    cout << vec[i] + 1;
    if(i == vec.sz-1)break;
    cout <<" ";
  }
  cout << endl;
  return 0;
}

```