#include <bits/stdc++.h>
using namespace std;
int n, t[5010], cnt[5010], ans[5010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", t + i);
  for (int i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof(cnt));
    int cl = t[i];
    for (int j = i; j <= n; j++) {
      cnt[t[j]]++;
      if (cnt[t[j]] > cnt[cl] || (cnt[t[j]] == cnt[cl] && t[j] < cl)) cl = t[j];
      ans[cl]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
