#include <bits/stdc++.h>
using namespace std;
int a[5020];
int ans[5020];
int dig[5020];
int n;
void input() {
  int i;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i <= n; i++) {
    ans[i] = 0;
  }
}
void solve() {
  int i, j;
  int m, idx;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      dig[j] = 0;
    }
    m = -1;
    for (j = i; j <= n; j++) {
      dig[a[j]]++;
      if (dig[a[j]] > m || dig[a[j]] == m && idx > a[j]) {
        m = dig[a[j]];
        idx = a[j];
      }
      ans[idx]++;
    }
  }
  for (i = 1; i < n; i++) {
    printf("%d ", ans[i]);
  }
  printf("%d\n", ans[n]);
}
int main() {
  while (scanf("%d", &n) != EOF) {
    input();
    solve();
  }
  return 0;
}
