#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN(5005);
int a[MAXN], b[MAXN], c[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    int maxc = 0, color = -1;
    for (int j = 1; j <= n; j++) b[j] = 0;
    for (int j = i; j <= n - 1; j++) {
      b[a[j]]++;
      if ((b[a[j]] > maxc) || (b[a[j]] == maxc && a[j] < color)) {
        maxc = b[a[j]];
        color = a[j];
      }
      c[color]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", c[i]);
}
