#include <bits/stdc++.h>

using namespace std;


signed main(){
    int N;cin >> N;
    vector<int> vec;
    for(int i = 0;i < N;i++){
        int b;cin >> b;
        vec.push_back(b);
    }
    map<int, int> mp1;
    set<int> s;
    map<int, int> mp2;
    vector<int> ans;
    for(int i = 0;i < N;i++){
        int j = N - i - 1;
        mp1[vec.at(i)]++;
        mp2[vec.at(j)]++;
        if(mp1[vec.at(i)] != mp2[vec.at(i)]){
            s.insert(vec.at(i));
        }else{
            s.erase(vec.at(i));
        }
        if(mp1[vec.at(j)] != mp2[vec.at(j)]){
            s.insert(vec.at(j));
        }else{
            s.erase(vec.at(j));
        }
        //cout<<s.size()<<endl;
        if(s.empty()){
            ans.push_back(i+1);
        }
    }
    for(int i = 0;i < ans.size();i++){
        cout<<ans.at(i)<<(i == ans.size() -1 ? "" : " ");
    }
    cout<<endl;
}


### Prompt

Generate 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;


signed main(){
    int N;cin >> N;
    vector<int> vec;
    for(int i = 0;i < N;i++){
        int b;cin >> b;
        vec.push_back(b);
    }
    map<int, int> mp1;
    set<int> s;
    map<int, int> mp2;
    vector<int> ans;
    for(int i = 0;i < N;i++){
        int j = N - i - 1;
        mp1[vec.at(i)]++;
        mp2[vec.at(j)]++;
        if(mp1[vec.at(i)] != mp2[vec.at(i)]){
            s.insert(vec.at(i));
        }else{
            s.erase(vec.at(i));
        }
        if(mp1[vec.at(j)] != mp2[vec.at(j)]){
            s.insert(vec.at(j));
        }else{
            s.erase(vec.at(j));
        }
        //cout<<s.size()<<endl;
        if(s.empty()){
            ans.push_back(i+1);
        }
    }
    for(int i = 0;i < ans.size();i++){
        cout<<ans.at(i)<<(i == ans.size() -1 ? "" : " ");
    }
    cout<<endl;
}


```