#include <bits/stdc++.h>
using namespace std;
int n, a[5005], have[5005], color[5005], maxn, max_co;
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 1; i <= n; i++) {
    memset(have, 0, sizeof(have));
    have[a[i]]++;
    color[a[i]]++;
    maxn = 1, max_co = a[i];
    for (j = i + 1; j <= n; j++) {
      have[a[j]]++;
      if (have[a[j]] > maxn) {
        maxn = have[a[j]];
        max_co = a[j];
      } else if (have[a[j]] == maxn && max_co > a[j]) {
        max_co = a[j];
      }
      color[max_co]++;
    }
  }
  for (i = 1; i <= n; i++) printf("%d ", color[i]);
  printf("\n");
  return 0;
}
