#include <bits/stdc++.h>
using namespace std;
int a[5005];
int b[5005];
int vis[5005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; i++) {
      memset(vis, 0, sizeof(vis));
      int ans1 = 0;
      int ans2 = 0;
      for (int j = i; j <= n; j++) {
        vis[a[j]]++;
        if ((ans1 < vis[a[j]]) || (ans1 == vis[a[j]] && ans2 > a[j])) {
          ans1 = vis[a[j]];
          ans2 = a[j];
        }
        b[ans2]++;
      }
    }
    for (int i = 1; i <= n - 1; i++) {
      printf("%d ", b[i]);
    }
    printf("%d\n", b[n]);
  }
}
