#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 10;
int n;
int a[N];
int main() {
  int ans[N] = {0};
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    int vis[N] = {0};
    int maxx = -N;
    int t;
    for (int j = i; j <= n; j++) {
      vis[a[j]]++;
      if (vis[a[j]] > maxx) {
        maxx = vis[a[j]];
        t = a[j];
      } else if (vis[a[j]] == maxx && a[j] < t)
        t = a[j];
      ans[t]++;
    }
    vis[a[i]]--;
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
