#include <bits/stdc++.h>
using namespace std;
int n, i, j, ma, a[5010], b[5010], otv[5010];
bool flag[5010];
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  for (i = 0; i < n; i++) {
    ma = -1;
    for (j = i; j < n; j++) {
      if (flag[a[j]] == false) {
        flag[a[j]] = true;
        b[a[j]] = 1;
      } else
        b[a[j]]++;
      if (ma == -1) {
        ma = a[j];
      } else if (b[ma] < b[a[j]])
        ma = a[j];
      else if (b[ma] == b[a[j]] && ma > a[j])
        ma = a[j];
      otv[ma]++;
    }
    fill(flag, flag + n, false);
  }
  for (i = 0; i < n - 1; i++) printf("%d ", otv[i]);
  printf("%d\n", otv[i]);
  return 0;
}
