import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] arr = new int[n]; long count = 0; ArrayList list = new ArrayList<>(); list.add(0); list.add(Integer.MAX_VALUE); for (int i = 0; i < n; i++) { arr[i] = Integer.parseInt(br.readLine()); int left = 0; int right = list.size(); while (right - left > 1) { int m = (left + right) / 2; if (list.get(m) <= arr[i]) { left = m; } else { right = m; } } count += list.size() - right - 1; list.add(right, arr[i]); } StringBuilder sb = new StringBuilder(); sb.append(count).append("\n"); for (int i = 0; i < n - 1; i++) { int left = 0; int right = list.size(); while (right - left > 1) { int m = (left + right) / 2; if (list.get(m) < arr[i]) { left = m; } else { right = m; } } count -= left; left = 0; right = list.size(); while (right - left > 1) { int m = (left + right) / 2; if (list.get(m) <= arr[i]) { left = m; } else { right = m; } } count += list.size() - right - 1; sb.append(count).append("\n"); } System.out.print(sb); } }