#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e18;
const long long N = 2e5 + 33;
void solve() {
  int64_t n;
  cin >> n;
  vector<int64_t> v(n + 1);
  for (int64_t i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<int64_t> ans(n + 10, 0);
  for (int64_t i = 0; i < n; i++) {
    vector<int64_t> mp(n + 10, 0);
    int64_t maxi = 0, num = 60000;
    for (int64_t j = i; j < n; j++) {
      mp[v[j]]++;
      if (maxi < mp[v[j]]) {
        maxi = mp[v[j]];
        num = v[j];
      }
      if (maxi == mp[v[j]] && num > v[j]) num = v[j];
      ans[num]++;
    }
  }
  for (int64_t i = 1; i <= n; i++) cout << ans[i] << " ";
}
signed main() {
  int64_t t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
}
