#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 5005;
int t[N], cnt[N], ans[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &t[i]);
  for (int i = 0; i < n; i++) {
    memset(cnt, 0, sizeof(cnt));
    int mx = 0, mxi = 1;
    for (int j = i; j < n; j++) {
      cnt[t[j]]++;
      if (cnt[t[j]] > mx) {
        mx = cnt[t[j]];
        mxi = t[j];
      } else if (cnt[t[j]] == mx) {
        mxi = min(mxi, t[j]);
      }
      ans[mxi]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
