using System; using System.Collections.Generic; using System.Linq; public class Yuki694 { public static void Main() { var n = int.Parse(Console.ReadLine()); var a = new List(); var b = new List(); string s; while((s = Console.ReadLine()) != null) { a.Add(int.Parse(s)); b.Add(int.Parse(s)); } b.Sort(); var cnt = 0; for(int i = 0; i < n; ++i) { for(int j = i + 1; j < n; ++j) if(a[i] > a[j]) ++cnt; } Console.WriteLine(cnt); for(int i = 0; i < n - 1; ++i) { var x = BinarySearch(b, a[i]) + 1; cnt += a.Count() - 2 * x + 1; Console.WriteLine(cnt); } } private static int BinarySearch(List list, int target) { var min = 0; var max = list.Count - 1; while(true) { if(max < min) return -1; var mid = min + (max - min) / 2; var dic = target - list[mid]; if (dic == 0) return mid; else if (dic < 0) max = mid - 1; else min = mid + 1; } } }