using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int testCaceCount = int.Parse(Reader.ReadLine()); for(int i=0; i dic = new Dictionary(); String[] inpt = Reader.ReadLine().Split(' '); foreach (String item in inpt) { long num = long.Parse(item); if(dic.ContainsKey(num)) { dic[num]++; } else { dic.Add(num, 1); } } int ans = 0; bool cannot = false; for(int j=0; j<100; j++) { if(dic.Count < 3) { cannot = true; break; } else { List> subList = dic.OrderBy(a=> a.Value).ToList(); subList.Reverse(); for(int k=0; k<3; k++) { dic[subList[k].Key]--; if(dic[subList[k].Key] <= 0) { dic.Remove(subList[k].Key); } } ans++; } } Console.WriteLine(ans); } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 4 8 2 2 5 8 7 3 8 8 3 1 1 1 6 1 1 2 2 2 3 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ', bool trim = false) { string inptStr = ReadLine(); if (trim) { inptStr = inptStr.Trim(); } string[] inpt = inptStr.Split(delimiter); int[] ret = new int[inpt.Length]; for (int i = 0; i < inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } static void Main() { Program prg = new Program(); prg.Proc(); } }