#include <bits/stdc++.h>
int a[10002], count[10002], ans[100002];
int main() {
  int n, i, j, max, k, val;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    max = -1;
    for (j = i; j <= n; j++) {
      count[a[j]]++;
      if (count[a[j]] > max) {
        max = count[a[j]];
        val = a[j];
      } else if (count[a[j]] == max) {
        if (val > a[j]) {
          val = a[j];
        }
      }
      ans[val]++;
    }
    for (j = 1; j <= n; j++) {
      count[a[j]] = 0;
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  if (n != 0) printf("\n");
  return 0;
}
