#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5000 + 5;
int t[MAXN], ans[MAXN], cnt[MAXN];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &t[i]);
    }
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++) {
      int maxcnt = -1, minpos = 0x3f3f3f3f;
      memset(cnt, 0, sizeof(cnt));
      for (int j = i; j <= n; j++) {
        cnt[t[j]]++;
        if (cnt[t[j]] > maxcnt) {
          maxcnt = cnt[t[j]];
          minpos = t[j];
        } else if (cnt[t[j]] == maxcnt) {
          minpos = min(minpos, t[j]);
        }
        ans[minpos]++;
      }
    }
    for (int i = 1; i <= n; i++) {
      printf("%d", ans[i]);
      printf("%c", i == n ? '\n' : ' ');
    }
  }
  return 0;
}
