#include <bits/stdc++.h>
using namespace std;
int a[5050], f[5050] = {0}, c[5050] = {0};
int main() {
  int i, j, m, n, k, t;
  scanf("%d", &n);
  a[0] = 0;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    memset(c, 0, sizeof(c));
    int ma = a[i];
    for (j = i; j <= n; j++) {
      c[a[j]]++;
      if (c[a[j]] > c[ma] || (c[a[j]] == c[ma] && ma > a[j])) ma = a[j];
      f[ma]++;
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", f[i]);
  return 0;
}
