/*  -*- coding: utf-8 -*-
 *
 * 2868.cc: Hierarchical Calculator
 */

#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 = 60;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N], v0[MAX_N], v1[MAX_N];
ll dp[2][MAX_N + 1];
int ls[2][MAX_N + 1], ps[2][MAX_N + 1], qs[2][MAX_N + 1];

/* subroutines */

inline void p2v(int l, int i0, int j0, int v[]) {
  for (int k = l - 1; k >= 0; k--) {
    v[k] = j0;
    int i1 = ps[i0][j0], j1 = qs[i0][j0];
    i0 = i1, j0 = j1;
  }
}

bool lex_lt(int l, int i0, int j0, int i1, int j1) {
  p2v(l, i0, j0, v0);
  p2v(l, i1, j1, v1);
  for (int i = 0; i < l; i++)
    if (v0[i] != v1[i]) return (v0[i] < v1[i]);
  return false;
}

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  for (int i = 0; i < 2; i++) {
    fill(dp[i], dp[i] + n + 1, 1);
    fill(ps[i], ps[i] + n + 1, -1);
    fill(qs[i], qs[i] + n + 1, -1);
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      ll d0 = dp[0][j] * as[i - 1], d1 = dp[1][j] * as[i - 1];
      int l0 = ls[0][j] + 1, l1 = ls[1][j] + 1;
      int p0 = 0, p1 = 1;
      if (d0 < d1) 
	swap(d0, d1), swap(l0, l1), swap(p0, p1);

      if (dp[0][i] < d0 ||
	  (dp[0][i] == d0 &&
	   (ls[0][i] > l0 ||
	    (ls[0][i] == l0 &&
	     lex_lt(l0 - 1, p0, j, ps[0][i], qs[0][i])))))
	dp[0][i] = d0, ls[0][i] = l0, ps[0][i] = p0, qs[0][i] = j;
      if (dp[1][i] > d1 ||
	  (dp[1][i] == d1 &&
	   (ls[1][i] > l1 ||
	    (ls[1][i] == l1 &&
	     lex_lt(l1 - 1, p1, j, ps[1][i], qs[1][i])))))
	dp[1][i] = d1, ls[1][i] = l1, ps[1][i] = p1, qs[1][i] = j;
    }
  }
  //for (int i = 0; i <= n; i++)
  //printf("%d: (%lld,%d,%d,%d) (%lld,%d,%d, %d)\n",
  //i, dp[0][i], ls[0][i], ps[0][i], qs[0][i],
  //dp[1][i], ls[1][i], ps[1][i], qs[1][i]);

  ll maxdp = 1;
  int mini = 0, minl = 0;
  for (int i = 0; i <= n; i++) {
    ll &dpi = dp[0][i];
    int &li = ls[0][i];
    if (maxdp < dpi ||
	(maxdp == dpi &&
	 (minl > li ||
	  (minl == li &&
	   lex_lt(li - 1, 0, i, 0, mini)))))
      maxdp = dpi, mini = i, minl = li;
  }
  //printf("maxdp=%lld, mini=%d, minl=%d\n", maxdp, mini, minl);

  p2v(minl, 0, mini, v0);
  printf("%d\n", minl);
  for (int i = 0; i < minl; i++) printf("%d\n", v0[i]);

  return 0;
}


### Prompt

Your challenge is to write a cpp solution to the following problem:

B： 階層的計算機 (Hierarchical Calculator)

Problem

Ebi-chan has N formulae: y = a_i x for i =1, ..., N (inclusive). Now she considers a subsequence of indices with length k: s_1, s_2, ..., s_k. At first, let x_0 be 1 and evaluate s_1-th formulae with x = x_0. Next, let x_1 be the output of s_1 and evaluate s_2-th formulae with x = x_1, and so on.

She wants to maximize the final output of the procedure, x_{s_k}. If there are many candidates, she wants the """shortest one""". If there are still many candidates, she wants the """lexicographically smallest one""".

Sequence s is lexicographically smaller than sequence t, if and only if either of the following conditions hold:

* there exists m < |s| such that s_i = t_i for i in 1 to m (inclusive) and s_{m+1} < t_{m+1}, or
* s_i = t_i for i in 1 to |s| (inclusive) and |s| < |t|,



where |s| is the length of the s.

Input


N
a_1 a_2 $\cdots$ a_N


Constraints

* 1 \leq N \leq 60
* -2 \leq a_i \leq 2 for i=1, ...,N (inclusive)
* Every input is given as the integer.



Output

Output k+1 lines. First line, the length of the sequence, k. Following k lines, the index of the i-th element of the subsequence, s_i (one element per line).

Sample Input 1


4
2 0 -2 1


Sample Output for Input 1


1
1


She evaluates the first one and gets the maximum value 2.

Sample Input 2


3
2 -2 -2


Sample Output for Input 2


3
1
2
3


She evaluates all of them and gets the maximum value 8.

Sample Input 3


2
-1 0


Sample Output for Input 3


0

She evaluates none of them and gets the maximum value 0. Empty sequence is the shorter and lexicographically smaller than any other sequences.

Sample Input 4


5
-1 2 1 -2 -1


Sample Output for Input 4


3
1
2
4


She evaluates $\langle$ 1, 2, 4 $\rangle$ ones and gets the maximum value 4. Note that $\langle$ 2, 4, 5 $\rangle$ is not lexicographically smallest one.





Example

Input

4
2 0 -2 1


Output

1
1

### Response

```cpp
/*  -*- coding: utf-8 -*-
 *
 * 2868.cc: Hierarchical Calculator
 */

#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 = 60;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N], v0[MAX_N], v1[MAX_N];
ll dp[2][MAX_N + 1];
int ls[2][MAX_N + 1], ps[2][MAX_N + 1], qs[2][MAX_N + 1];

/* subroutines */

inline void p2v(int l, int i0, int j0, int v[]) {
  for (int k = l - 1; k >= 0; k--) {
    v[k] = j0;
    int i1 = ps[i0][j0], j1 = qs[i0][j0];
    i0 = i1, j0 = j1;
  }
}

bool lex_lt(int l, int i0, int j0, int i1, int j1) {
  p2v(l, i0, j0, v0);
  p2v(l, i1, j1, v1);
  for (int i = 0; i < l; i++)
    if (v0[i] != v1[i]) return (v0[i] < v1[i]);
  return false;
}

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  for (int i = 0; i < 2; i++) {
    fill(dp[i], dp[i] + n + 1, 1);
    fill(ps[i], ps[i] + n + 1, -1);
    fill(qs[i], qs[i] + n + 1, -1);
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      ll d0 = dp[0][j] * as[i - 1], d1 = dp[1][j] * as[i - 1];
      int l0 = ls[0][j] + 1, l1 = ls[1][j] + 1;
      int p0 = 0, p1 = 1;
      if (d0 < d1) 
	swap(d0, d1), swap(l0, l1), swap(p0, p1);

      if (dp[0][i] < d0 ||
	  (dp[0][i] == d0 &&
	   (ls[0][i] > l0 ||
	    (ls[0][i] == l0 &&
	     lex_lt(l0 - 1, p0, j, ps[0][i], qs[0][i])))))
	dp[0][i] = d0, ls[0][i] = l0, ps[0][i] = p0, qs[0][i] = j;
      if (dp[1][i] > d1 ||
	  (dp[1][i] == d1 &&
	   (ls[1][i] > l1 ||
	    (ls[1][i] == l1 &&
	     lex_lt(l1 - 1, p1, j, ps[1][i], qs[1][i])))))
	dp[1][i] = d1, ls[1][i] = l1, ps[1][i] = p1, qs[1][i] = j;
    }
  }
  //for (int i = 0; i <= n; i++)
  //printf("%d: (%lld,%d,%d,%d) (%lld,%d,%d, %d)\n",
  //i, dp[0][i], ls[0][i], ps[0][i], qs[0][i],
  //dp[1][i], ls[1][i], ps[1][i], qs[1][i]);

  ll maxdp = 1;
  int mini = 0, minl = 0;
  for (int i = 0; i <= n; i++) {
    ll &dpi = dp[0][i];
    int &li = ls[0][i];
    if (maxdp < dpi ||
	(maxdp == dpi &&
	 (minl > li ||
	  (minl == li &&
	   lex_lt(li - 1, 0, i, 0, mini)))))
      maxdp = dpi, mini = i, minl = li;
  }
  //printf("maxdp=%lld, mini=%d, minl=%d\n", maxdp, mini, minl);

  p2v(minl, 0, mini, v0);
  printf("%d\n", minl);
  for (int i = 0; i < minl; i++) printf("%d\n", v0[i]);

  return 0;
}


```