using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ HashSet H = new HashSet(); var pp = new MSet(); pp.Add(X); H.Add(pp); for(int i=1;i nxt = new HashSet(); foreach(var p in H){ for(int j=0;j0 && p[j] == p[j-1]) continue; int k = p[j]; for(int t=2;t*t<=k+1;t++){ if((k+1)%t != 0) continue; var q = new MSet(p); q.Push(t-1,(k+1)/t-1,j); nxt.Add(q); } } } H = nxt; } Console.WriteLine(H.Count); } class MSet{ public List L; int hash; public int Count{ get{ return L.Count;} } public MSet(IEnumerable l){ L = new List(l); L.Sort(); hash = L.Aggregate( (s,t) => s^t ); } public MSet(){ L = new List(); hash = 0; } public MSet(MSet p){ L = new List(p.L); hash = p.hash; } public int this[int idx]{ get {return L[idx];} } public void Add(int x){ L.Add(x); L.Sort(); hash ^= x; } public void Push(int x,int y,int idx){ L[idx] = x; L.Add(y); L.Sort(); } public override bool Equals(System.Object obj){ if(obj == null) return false; MSet p = (MSet) obj; if((System.Object) p == null ) return false; return chkEqual(p); } bool chkEqual(MSet p){ if(p.Count != L.Count)return false; for(int i=0;iint.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }