Problem: As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any three snowballs whose radii are pairwise different. For example, the balls with radii 1, 2 and 3 can be used to make a snowman but 2, 2, 3 or 2, 2, 2 cannot. Help Sergey and his twins to determine what maximum number of snowmen they can make from those snowballs.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.

Output

Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the snowmen in any order. If there are several solutions, print any of them.

Examples

Input

7
1 2 3 4 5 6 7


Output

2
3 2 1
6 5 4


Input

3
2 2 3


Output

0

Solution (in JAVA):

Solution:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class NewYearSnowmen {
	public static void main(String[] args) {
		FastScanner scanner = new FastScanner();
		
		//sort each number into its own bucket for easy different number finding
		int ballNum = scanner.nextInt();
		SnowHashMap snowHashMap = new SnowHashMap(1000000);
		for(int i = 0; i < ballNum; i++) {
			int newValue = scanner.nextInt();
			snowHashMap.add(newValue, 1);
		}
		ArrayList<Integer[]> buckets = snowHashMap.getPositiveHeap();
		ArrayList<Integer[]> outList = new ArrayList<Integer[]>();
		int totalSnowmen = 0;
		//as long as we have at least 3 different sized balls, make snowmen using buckets with most balls first
		outer: while(true) {
			Integer[] snowman = new Integer[3];
			if(buckets.size() < 3) break;
			Integer[] bucket0 = buckets.get(0);
			Integer[] bucket1 = null;
			Integer[] bucket2 = null;
			int idx1 = 0;
			int idx2 = 0;
			if(buckets.get(1)[1] > buckets.get(2)[1]) {
				bucket1 = buckets.get(1);
				idx1 = 1;
				bucket2 = buckets.get(2);
				idx2 = 2;
				if(buckets.size() > 3 && buckets.get(3)[1] > bucket2[1]) {
					idx2 = 3;
					bucket2 = buckets.get(3);
				}
				if(buckets.size() > 4 && buckets.get(4)[1] > bucket2[1]) {
					idx2 = 4;
					bucket2 = buckets.get(4);
				}
			} else {
				bucket1 = buckets.get(2);
				idx1 = 2;
				bucket2 = buckets.get(1);
				idx2 = 1;
				if(buckets.size() > 5 && buckets.get(5)[1] > bucket2[1]) {
					idx2 = 5;
					bucket2 = buckets.get(5);
				}
				if(buckets.size() > 6 && buckets.get(6)[1] > bucket2[1]) {
					idx2 = 6;
					bucket2 = buckets.get(6);
				}
			}
			
			if(bucket0[1] < 1 || bucket1[1] < 1 || bucket2[1] < 1) {
				break outer;
			}
			snowman[0] = bucket0[0];
			snowman[1] = bucket1[0];
			snowman[2] = bucket2[0];
			bucket0[1]--;
			bucket1[1]--;
			bucket2[1]--;
			buckets.set(0, bucket0);
			buckets.set(idx1, bucket1);
			buckets.set(idx2, bucket2);
			
			
			//maintain heap structure
			boolean movedAny = true;
			while(movedAny) {
				movedAny = false;
				boolean movedFirst = percDown(buckets, idx2);
				boolean movedSecond = percDown(buckets, idx1);
				boolean movedThird = percDown(buckets, 0);
				if(movedFirst || movedSecond || movedThird) {
					movedAny = true;
				}
			}
			
			//sort the snowman to have biggest ball first
			if(snowman[0] < snowman[1]) {
				int temp = snowman[1];
				snowman[1] = snowman[0];
				snowman[0] = temp;
			}
			if(snowman[1] < snowman[2]) {
				int temp = snowman[2];
				snowman[2] = snowman[1];
				snowman[1] = temp;
			}
			if(snowman[0] < snowman[1]) {
				int temp = snowman[1];
				snowman[1] = snowman[0];
				snowman[0] = temp;
			}
			outList.add(snowman);
			totalSnowmen++;
		}
		System.out.println(totalSnowmen);
		for(int i = 0; i < outList.size(); i++) {
			Integer[] snowman = outList.get(i);
			System.out.println(snowman[0] + " " + snowman[1] + " " + snowman[2]);
		}
	}
	
	public static boolean percDown(ArrayList<Integer[]> arr, int i) {
		int size = arr.size();
		int left = i*2+1;
		int right = i*2+2;
		int big = i;
		if(left < size && arr.get(left)[1] > arr.get(big)[1]) big = left;
		if(right < size && arr.get(right)[1] > arr.get(big)[1]) big = right;
		if(big != i) {
			Integer[] temp = arr.get(big);
			arr.set(big, arr.get(i));
			arr.set(i, temp);
			percDown(arr, big);
			return true;
		}
		return false;
	}
	
	public static void insertToHeap(Integer[] element, ArrayList<Integer[]> heap) {
		heap.add(element);
		int i = heap.size()-1;
		int parent = (i+1)/2-1;
		while(i > 0 && heap.get(i)[1] > heap.get(parent)[1]) {
			Integer[] temp = heap.get(i);
			heap.set(i, heap.get(parent));
			heap.set(parent, temp);
			i = parent;
			parent = (i+1)/2-1;
		}
	}
	
	static class SnowHashMap {
		Integer[][] map;
		public SnowHashMap(int size) {
			map = new Integer[size][2];
		}
		public void add(int key, int value) {
			int index = hash(key);
			while(map[index][0] != null && map[index][0] != key) index++;
			if(map[index][0] == null) {
				Integer[] toSave = {key, value};
				map[index] = toSave;
			} else {
				map[index][1] += value;
			}
		}
		public void subtract(int key, int value) {
			add(key, -value);
		}
		public int get(int key) {
			int index = hash(key);
			while(map[index][0] != null && map[index][0] != key) index++;
			return map[index][1];
		}
		public ArrayList<Integer[]> getPositiveHeap() {
			ArrayList<Integer[]> retList = new ArrayList<Integer[]>();
			for(int i = 0; i < map.length; i++) {
				if(map[i][0] != null && map[i][0] > 0 && map[i][1] > 0) {
					insertToHeap(map[i], retList);
				}
			}
			return retList;
		}
		public int hash(int key) {
			return Math.abs(key*31)%map.length;
		}
	}
	
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String nextLine() {
			String returnString = "";
			try {
				returnString = br.readLine();
			} catch(IOException e) {
				e.printStackTrace();
			}
			return returnString;
		}
		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
}