#include <bits/stdc++.h>
const int N = (int)5555;
int a[N], n, cnt[N], ans[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]), --a[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) cnt[j] = 0;
    int mx = -1;
    for (int j = i; j < n; ++j) {
      cnt[a[j]]++;
      if ((mx == -1) || (cnt[a[j]] > cnt[mx]) ||
          ((cnt[a[j]] == cnt[mx]) && (a[j] < mx)))
        mx = a[j];
      ans[mx]++;
    }
  }
  for (int i = 0; i < n; ++i) printf("%d%c", ans[i], " \n"[i == n - 1]);
  return 0;
}
