#include <bits/stdc++.h>
using namespace std;
const long long large = 1000010;
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans[5050];
  memset(ans, 0, sizeof ans);
  for (long long i = 0; i < n; i++) {
    long long cnt[5050];
    memset(cnt, 0, sizeof cnt);
    long long best = 0;
    for (long long j = i; j < n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[best] or (cnt[a[j]] == cnt[best] and a[j] < best))
        best = a[j];
      ans[best]++;
    }
  }
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
}
int main() {
  long long kse = 1;
  while (kse--) {
    solve();
  }
}
