#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k, l, ar[5004], mx, in, c, p, vs[5004], res[5004];
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &ar[i]);
  }
  memset(res, 0, sizeof res);
  for (i = 1; i <= n; i++) {
    mx = 0;
    memset(vs, 0, sizeof vs);
    for (j = i; j <= n; j++) {
      vs[ar[j]]++;
      if (mx < vs[ar[j]]) {
        c = ar[j];
        mx = vs[ar[j]];
      } else if (mx == vs[ar[j]] && ar[j] < c) {
        c = ar[j];
      }
      res[c]++;
    }
  }
  for (i = 1; i < n; i++) {
    printf("%lld ", res[i]);
  }
  printf("%lld\n", res[i]);
}
