using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = ConvertStringArrayToIntArray(Console.ReadLine().Split()); var d = A.Where(x => x < 0).OrderBy(x => x).ToArray(); var cm1 = A.Where(x => x >= 0).OrderByDescending(x => x).ToArray(); int cnt = 0; bool isMatch; for (int i = 0; i < d.Length; i++) { isMatch = false; for (int j = 0; j < cm1.Length; j++) { if (d[i] + cm1[j] < 0) { isMatch = true; cnt++; break; } } if (!isMatch) { cnt += (d.Length - i) / 2; break; } } int dry = cnt; //---------------------------- var w = A.Where(x => x > 0).OrderByDescending(x => x).ToArray(); var cm2 = A.Where(x => x <= 0).OrderBy(x => x).ToArray(); cnt = 0; for (int i = 0; i < w.Length; i++) { isMatch = false; for (int j = 0; j < cm2.Length; j++) { if (w[i] + cm2[j] > 0) { isMatch = true; cnt++; break; } } if (!isMatch) { cnt += (w.Length - i) / 2; break; } } int wet = cnt; //------------------------------ cnt = 0; for (int i = 0; i < d.Length; i++) { for (int j = 0; j < w.Length; j++) { if (d[i] + w[j] == 0) { cnt++; } } } var moi = A.Where(x => x == 0).Count() + cnt; Console.WriteLine("{0} {1} {2}",dry,wet,moi); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }