#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (auto &u : arr) cin >> u;
  vector<long long> ans(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    vector<long long> cnt(n + 1, 0);
    long long best = 0;
    for (long long j = i; j < n; j++) {
      cnt[arr[j]]++;
      if (cnt[best] < cnt[arr[j]]) {
        best = arr[j];
      } else if (cnt[best] == cnt[arr[j]] && arr[j] < best)
        best = arr[j];
      ans[best]++;
    }
  }
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
