using System; using System.Collections.Generic; using System.Linq; class Dataset { public int V1 { get; set; } public int V2 { get; set; } } public class Yuki694 { public static void Main() { var n = int.Parse(Console.ReadLine()); var a = new List(); string s; while((s = Console.ReadLine()) != null) a.Add(int.Parse(s)); 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); var dic = new List(); for(int i = 0; i < n; ++i) { var x = a[i]; var p = a.Count(y => y > x); var m = a.Count(y => y < x); dic.Add(new Dataset {V1 = p, V2 = m}); } for(int i = 0; i < n - 1; ++i) { cnt = cnt + dic[i].V1- dic[i].V2; Console.WriteLine(cnt); } } }