Team Olympiad

题意翻译

在柏林首都学校里面学习的有n个孩子。这所学校的所有孩子都很有天赋:有些孩子擅长编程,有些孩子擅长数学,还有一些孩子擅长体育。因此,我们知道每个孩子的价值: >擅长编程的孩子的价值: 1 >擅长数学的孩子的价值: 2 >擅长体育的孩子的价值: 3 科学十项全能奥林匹克运动队需要三个学生组成小组。学校老师决定,小组由三个擅长不同科目的孩子组成。也就是说,每个小组必须有一个擅长数学的孩子,一个擅长编程的孩子和一个擅长体育的孩子。当然,每个孩子可以是多个团队的成员。学校能参加奥运会的参赛队伍的最大数量是多少?如何组建团队?

题目描述

The School №0 of the capital of Berland has $ n $ children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value $ t_{i} $ : - $ t_{i}=1 $ , if the $ i $ -th child is good at programming, - $ t_{i}=2 $ , if the $ i $ -th child is good at maths, - $ t_{i}=3 $ , if the $ i $ -th child is good at PE Each child happens to be good at exactly one of these three subjects. The Team Scientific Decathlon Olympias requires teams of three students. The school teachers decided that the teams will be composed of three children that are good at different subjects. That is, each team must have one mathematician, one programmer and one sportsman. Of course, each child can be a member of no more than one team. What is the maximum number of teams that the school will be able to present at the Olympiad? How should the teams be formed for that?

输入输出格式

输入格式


The School №0 of the capital of Berland has $ n $ children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value $ t_{i} $ : - $ t_{i}=1 $ , if the $ i $ -th child is good at programming, - $ t_{i}=2 $ , if the $ i $ -th child is good at maths, - $ t_{i}=3 $ , if the $ i $ -th child is good at PE Each child happens to be good at exactly one of these three subjects. The Team Scientific Decathlon Olympias requires teams of three students. The school teachers decided that the teams will be composed of three children that are good at different subjects. That is, each team must have one mathematician, one programmer and one sportsman. Of course, each child can be a member of no more than one team. What is the maximum number of teams that the school will be able to present at the Olympiad? How should the teams be formed for that?

输出格式


In the first line output integer $ w $ — the largest possible number of teams. Then print $ w $ lines, containing three numbers in each line. Each triple represents the indexes of the children forming the team. You can print both the teams, and the numbers in the triplets in any order. The children are numbered from $ 1 $ to $ n $ in the order of their appearance in the input. Each child must participate in no more than one team. If there are several solutions, print any of them. If no teams can be compiled, print the only line with value $ w $ equal to 0.

输入输出样例

输入样例 #1

7
1 3 1 3 2 1 2

输出样例 #1

2
3 5 2
6 7 4

输入样例 #2

4
2 1 1 2

输出样例 #2

0