#include <bits/stdc++.h>
using namespace std;
int n, curbest;
int ans[5005], t[5005];
int cnt[5005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i];
  for (int i = 1; i <= n; i++) {
    curbest = 0;
    memset(cnt, 0, sizeof cnt);
    for (int j = i; j <= n; j++) {
      cnt[t[j]]++;
      if (cnt[t[j]] > cnt[curbest] ||
          cnt[t[j]] == cnt[curbest] && t[j] < curbest) {
        curbest = t[j];
      }
      ans[curbest]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i];
    if (i != n)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}
