#CCBCHBAHAI0000112. Team Olympiad

Team Olympiad

Team Olympiad

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem

Each student has type ti∈{1,2,3}t_i\in\{1,2,3\}. A team needs one student of every type, and no student can be reused. If cjc_j is the count of type jj, the maximum team count is w=min⁡(c1,c2,c3)w=\min(c_1,c_2,c_3). For deterministic judging, list indices of each type in increasing order and make team kk from the kk-th index of types 1, 2, and 3, in that order.

Input

The first line contains nn. The second line contains t1,…,tnt_1,\ldots,t_n.

Output

Print ww, then ww deterministic triples. If w=0w=0, print only 0.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10.

Subtask 2 (30 points): 1≤n≤5001\le n\le500.

Subtask 3 (50 points): 1≤n≤50001\le n\le5000.

Example

Input

7
1 3 1 3 2 1 2

Output

2
1 5 2
3 7 4

Explanation

The type-index lists are (1,3,6), (5,7), and (2,4), so two teams are produced.