#include<bits/stdc++.h>
using namespace std;

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;cin>>n;
  vector<int> a(n);
  int i;
  rep(i,n)cin>>a[i];
  priority_queue<int> pq1;
  priority_queue<int> pq2;
  vector<int> ans(0);
  rep(i,n)
  {
    pq1.push(a[i]);
    pq2.push(a[n-1-i]);
    //cout<<pq1.top()<<' '<<pq2.top()<<endl;
    while(pq1.size()>0&&pq1.top()==pq2.top())
    {
      pq1.pop();
      pq2.pop();
    }
    if(pq1.size()==0)
    {
      ans.emplace_back(i+1);
    }
  }
  rep(i,ans.size())
  {
    if(i!=0)cout<<' ';
    cout<<ans[i];
  }
  cout<<endl;
}

### Prompt

Your challenge is to write 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<bits/stdc++.h>
using namespace std;

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;cin>>n;
  vector<int> a(n);
  int i;
  rep(i,n)cin>>a[i];
  priority_queue<int> pq1;
  priority_queue<int> pq2;
  vector<int> ans(0);
  rep(i,n)
  {
    pq1.push(a[i]);
    pq2.push(a[n-1-i]);
    //cout<<pq1.top()<<' '<<pq2.top()<<endl;
    while(pq1.size()>0&&pq1.top()==pq2.top())
    {
      pq1.pop();
      pq2.pop();
    }
    if(pq1.size()==0)
    {
      ans.emplace_back(i+1);
    }
  }
  rep(i,ans.size())
  {
    if(i!=0)cout<<' ';
    cout<<ans[i];
  }
  cout<<endl;
}

```