/*  -*- coding: utf-8 -*-
 *
 * 2876.cc: Anagram
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int P = 4073;
const int MOD = 1000000009;

/* typedef */

typedef long long ll;
typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

int eps[MAX_N], ieps[MAX_N];
int as[MAX_N], bs[MAX_N];
int ks[MAX_N];

/* subroutines */

int powmod(int a, int b) {
  int p = 1;
  while (b) {
    if (b & 1) p = (ll)p * a % MOD;
    a = (ll)a * a % MOD;
    b >>= 1;
  }
  return p;
}

/* main */

int main() {
  int ip = powmod(P, MOD - 2);
  eps[0] = ieps[0] = 1;
  for (int i = 1; i < MAX_N; i++) {
    eps[i] = (ll)eps[i - 1] * P % MOD;
    ieps[i] = (ll)ieps[i - 1] * ip % MOD;
  }

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i), bs[i] = as[i];
  sort(bs, bs + n);
  int m = unique(bs, bs + n) - bs;

  int kn = 0, rh0 = 0, rh1 = 0;
  for (int k = 0; k < n; k++) {
    int i0 = lower_bound(bs, bs + m, as[k]) - bs;
    int i1 = lower_bound(bs, bs + m, as[n - 1 - k]) - bs;
    rh0 = (rh0 + (ll)i0 * eps[i0] % MOD) % MOD;
    rh1 = (rh1 + (ll)i1 * eps[i1] % MOD) % MOD;
    //printf("%d: rh0=%d, rh1=%d\n", k, rh0, rh1);
    if (rh0 == rh1) ks[kn++] = k;
  }

  for (int i = 0; i < kn; i++) {
    if (i) putchar(' ');
    printf("%d", ks[i] + 1);
  }
  putchar('\n');
  return 0;
}


### Prompt

Develop a solution in CPP to the problem described below:

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
/*  -*- coding: utf-8 -*-
 *
 * 2876.cc: Anagram
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int P = 4073;
const int MOD = 1000000009;

/* typedef */

typedef long long ll;
typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

int eps[MAX_N], ieps[MAX_N];
int as[MAX_N], bs[MAX_N];
int ks[MAX_N];

/* subroutines */

int powmod(int a, int b) {
  int p = 1;
  while (b) {
    if (b & 1) p = (ll)p * a % MOD;
    a = (ll)a * a % MOD;
    b >>= 1;
  }
  return p;
}

/* main */

int main() {
  int ip = powmod(P, MOD - 2);
  eps[0] = ieps[0] = 1;
  for (int i = 1; i < MAX_N; i++) {
    eps[i] = (ll)eps[i - 1] * P % MOD;
    ieps[i] = (ll)ieps[i - 1] * ip % MOD;
  }

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i), bs[i] = as[i];
  sort(bs, bs + n);
  int m = unique(bs, bs + n) - bs;

  int kn = 0, rh0 = 0, rh1 = 0;
  for (int k = 0; k < n; k++) {
    int i0 = lower_bound(bs, bs + m, as[k]) - bs;
    int i1 = lower_bound(bs, bs + m, as[n - 1 - k]) - bs;
    rh0 = (rh0 + (ll)i0 * eps[i0] % MOD) % MOD;
    rh1 = (rh1 + (ll)i1 * eps[i1] % MOD) % MOD;
    //printf("%d: rh0=%d, rh1=%d\n", k, rh0, rh1);
    if (rh0 == rh1) ks[kn++] = k;
  }

  for (int i = 0; i < kn; i++) {
    if (i) putchar(' ');
    printf("%d", ks[i] + 1);
  }
  putchar('\n');
  return 0;
}


```