#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
int n, m, cnt, dfs_num, CN, flag;
int num[5050], cot[5050], las[5050];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
    memset(las, 0, sizeof las);
    for (int i = 1; i <= n; i++) {
      memset(cot, 0, sizeof cot);
      int k = n + 1;
      for (int j = i; j <= n; j++) {
        if (++cot[num[j]] > cot[k] || (cot[num[j]] == cot[k] && num[j] < k))
          k = num[j];
        las[k]++;
      }
    }
    printf("%d", las[1]);
    for (int i = 2; i <= n; i++) printf(" %d", las[i]);
    puts("");
  }
}
