#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<int> ans(n + 1);
  for (int i = 0; i < n; i++) {
    int dominant = 0;
    vector<int> m(n + 1);
    for (int j = i; j < n; j++) {
      m[x[j]]++;
      if (m[x[j]] > m[dominant] or (m[x[j]] == m[dominant] and x[j] < dominant))
        dominant = x[j];
      ans[dominant]++;
    }
  }
  for (int i = 1; i < n + 1; i++) cout << ans[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
