#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    map<int, int> cnt;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector<int> ans;
    for (int i = 0; i < n; ++i) {
      int l = a[i], r = a[n - i - 1];
      cnt[l]++;
      cnt[r]--;
      if (cnt[l] == 0) cnt.erase(l);
      if (cnt[r] == 0) cnt.erase(r);
      if (cnt.size() == 0) {
        ans.push_back(i);
      }
    }
    for (int i = 0; i < ans.size(); ++i) {
      cout << ans[i] + 1;
      if (i + 1 == ans.size()) {
        cout << endl;
      } else {
        cout << ' ';
      }
    }
  }
}
