#include <bits/stdc++.h>
using namespace std;
int cnt[5005];
int ans[5005], a[100005];
int main() {
  int i, j, k, l, m, n, id, mx;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof(cnt));
    mx = 0;
    id = 2000000000;
    for (j = i; j <= n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > mx) {
        mx = cnt[a[j]];
        id = a[j];
      } else if (cnt[a[j]] == mx && id > a[j])
        id = a[j];
      ans[id]++;
    }
  }
  printf("%d", ans[1]);
  for (i = 2; i <= n; i++) printf(" %d", ans[i]);
  printf("\n");
  return 0;
}
