#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n; cin >> n;
  ll a[n]; REP(i,n) cin >> a[i];
  map<ll,ll> mp;
  vector<ll> ans;
  REP(i,n){
    mp[a[i]]++ , mp[a[n-1-i]]--;
    if(mp[a[i]]==0) mp.erase(a[i]);
    if(mp[a[n-1-i]]==0) mp.erase(a[n-1-i]);
    if(mp.empty()) ans.push_back(i+1);
  }
  for(auto v: ans){
    cout << v ;
    if(v!=ans.back()) cout << " ";
  }
  cout << endl;
  return 0;
}


### 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 <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n; cin >> n;
  ll a[n]; REP(i,n) cin >> a[i];
  map<ll,ll> mp;
  vector<ll> ans;
  REP(i,n){
    mp[a[i]]++ , mp[a[n-1-i]]--;
    if(mp[a[i]]==0) mp.erase(a[i]);
    if(mp[a[n-1-i]]==0) mp.erase(a[n-1-i]);
    if(mp.empty()) ans.push_back(i+1);
  }
  for(auto v: ans){
    cout << v ;
    if(v!=ans.back()) cout << " ";
  }
  cout << endl;
  return 0;
}


```