#include <bits/stdc++.h>
using namespace std;
const int maxn = 5010;
int balls[maxn];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &balls[i]);
    balls[i]--;
  }
  int ans[n];
  fill(ans, ans + n, 0);
  for (int start = 0; start < (int)(n); start++) {
    int tracking[n];
    fill(tracking, tracking + n, 0);
    int maxcolor = balls[start];
    int maxcnt = 1;
    tracking[maxcolor]++;
    ans[maxcolor]++;
    for (int i = start + 1; i < n; i++) {
      tracking[balls[i]]++;
      if (tracking[balls[i]] > maxcnt) {
        maxcolor = balls[i];
        maxcnt = tracking[balls[i]];
      } else if (tracking[balls[i]] == maxcnt) {
        if (balls[i] < maxcolor) maxcolor = balls[i];
      } else if (maxcolor == balls[i])
        maxcnt++;
      ans[maxcolor]++;
    }
  }
  for (int i = 0; i < (int)(n); i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}
