#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  map<int, int> cnt;
  vector<int> answer;
  REP(i,n) {
    if((cnt.find(a[i])!=cnt.end()) && cnt[a[i]]==-1) cnt.erase(a[i]);
    else ++cnt[a[i]];
    if((cnt.find(a[n-1-i])!=cnt.end()) && cnt[a[n-1-i]]==1) cnt.erase(a[n-1-i]);
    else --cnt[a[n-1-i]];
    if(cnt.empty()) answer.push_back(i+1);
  }
  REP(i,(int)answer.size()) {
    if(i) cout << ' ';
    cout << answer[i];
  }
  cout << endl;
  return 0;
}


### Prompt

Create a solution in Cpp for 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>
typedef long long LL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];
  map<int, int> cnt;
  vector<int> answer;
  REP(i,n) {
    if((cnt.find(a[i])!=cnt.end()) && cnt[a[i]]==-1) cnt.erase(a[i]);
    else ++cnt[a[i]];
    if((cnt.find(a[n-1-i])!=cnt.end()) && cnt[a[n-1-i]]==1) cnt.erase(a[n-1-i]);
    else --cnt[a[n-1-i]];
    if(cnt.empty()) answer.push_back(i+1);
  }
  REP(i,(int)answer.size()) {
    if(i) cout << ' ';
    cout << answer[i];
  }
  cout << endl;
  return 0;
}


```