#include <bits/stdc++.h>
using namespace std;
long long int n, ans[5007], a[5007], cnt[5007];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; ++i) {
    memset(cnt, 0, sizeof(cnt[0]) * 5007);
    long long int best = a[i];
    for (long long int j = i; j < n; ++j) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[best] || (cnt[a[j]] == cnt[best] && a[j] < best)) {
        best = a[j];
      }
      ans[best]++;
    }
  }
  for (long long int i = 1; i <= n; ++i) cout << ans[i] << ' ';
  cout << '\n';
  return 0;
}
