#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, 0, N) cin >> A[i];

  map<ll, ll> mp;
  ll cnt = 0;
  vector<ll> ans;
  REP(i, 0, N) {
    ll k = i + 1;
    if(mp[A[i]] >= 0) {
      cnt++;
    } else {
      cnt--;
    }
    mp[A[i]]++;
    if(mp[A[N - i - 1]] <= 0) {
      cnt++;
    } else {
      cnt--;
    }
    mp[A[N - i - 1]]--;
    if(cnt == 0) ans.push_back(k);
  }
  REP(i, 0, ans.size()) cout << ans[i] << (i + 1 != ans.size() ? " " : "\n");
}


### Prompt

Please formulate 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>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

int main(void) {
  ll N;
  cin >> N;
  vector<ll> A(N);
  REP(i, 0, N) cin >> A[i];

  map<ll, ll> mp;
  ll cnt = 0;
  vector<ll> ans;
  REP(i, 0, N) {
    ll k = i + 1;
    if(mp[A[i]] >= 0) {
      cnt++;
    } else {
      cnt--;
    }
    mp[A[i]]++;
    if(mp[A[N - i - 1]] <= 0) {
      cnt++;
    } else {
      cnt--;
    }
    mp[A[N - i - 1]]--;
    if(cnt == 0) ans.push_back(k);
  }
  REP(i, 0, ans.size()) cout << ans[i] << (i + 1 != ans.size() ? " " : "\n");
}


```