#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = int(1e9);
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n), res(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int best = i;
    vector<int> cnt(n + 1);
    for (int j = i; j < n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[best]) {
        best = a[j];
      } else if (cnt[a[j]] == cnt[best]) {
        best = min(a[j], best);
      }
      res[best]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  return 0;
}
