We’re preparing your current view and syncing the latest data.
You are given n students, each knows one of three subjects: programming (1), math (2), or physical education (3). Your task is to form as many teams as possible, where each team consists of exactly three students, each specializing in a different subject. Output the maximum number of teams and the indices of students forming these teams.
The first line contains an integer n (1 ≤ n ≤ 5000) — the number of students. The second line contains n integers a_i (a_i ∈ {1, 2, 3}) where each integer represents the subject a student knows.
On the first line output the maximum number of teams formed. Then output each team in a new line with three integers — the indices of the students in that team such that the first student knows programming (1), the second knows math (2), and the third knows physical education (3).
1 ≤ n ≤ 5000 a_i ∈ {1, 2, 3}
Example 1
Input
7 1 3 1 3 2 1 2
Output
2 1 5 2 3 7 4
Explanation
We have students: 1 (programming), 2 (physical education), 3 (programming), 4 (physical education), 5 (math), 6 (programming), 7 (math). Teams formed: Team 1: Student 1 (programming), Student 5 (math), Student 2 (physical education) Team 2: Student 3 (programming), Student 7 (math), Student 4 (physical education)