#include <bits/stdc++.h>
int main() {
  int ara[5001], i, n, mx = 0, j, ans[5001] = {0}, col[5001] = {0}, eq, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &ara[i]);
  for (i = 1; i <= n; i++) {
    for (k = 1; k <= n; k++) col[k] = 0;
    mx = 0, eq = 0;
    for (j = i; j <= n; j++) {
      col[ara[j]]++;
      if (col[ara[j]] > mx || (col[ara[j]] == mx && ara[j] < eq)) {
        mx = col[ara[j]];
        eq = ara[j];
      }
      ans[eq]++;
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
}
