using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int itemCount = int.Parse(Reader.ReadLine()); int[] items = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).OrderBy(a=>a).ToArray(); int max = items[items.Length - 1]; Dictionary dic = new Dictionary(); for(int i=0; i tmp) { for(int j=2; j<=tmp; j++) { if(dic.ContainsKey(num*j)) { dic[num*j].Add(t); } } } else { for(int j=i+1; j Items = new List(); public TreeNode Add(TreeNode child) { this.Items.Add(child); return child; } public int Length { get { if(this.LenValue == null) { if(this.Items.Count == 0) { this.LenValue = 1; } else { this.LenValue = this.Items.Max(a=>a.Length) + 1; } } return this.LenValue.Value; } } private Nullable LenValue = null; public TreeNode(int idx, int num) { this.Index = idx; this.Number = num; } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 7 1 2 22 88 8 4 440 "; 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(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }