#include <bits/stdc++.h>
using namespace std;
int an[5005], t[5005], cnt[5005];
template <typename _Tp>
struct cmp : public binary_function<_Tp, _Tp, bool> {
  bool operator()(const _Tp& __x, const _Tp& __y) const {
    return __x.second == __y.second ? __x.first > __y.first
                                    : __x.second < __y.second;
  }
};
pair<int, int> mx;
priority_queue<pair<int, int>, vector<pair<int, int> >, cmp<pair<int, int> > >
    m;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &t[i]);
  for (int i = 0; i < n; i++) {
    mx = make_pair(1e7, 0);
    memset(cnt, 0, sizeof(cnt));
    for (int j = i; j < n; j++) {
      cnt[t[j]]++;
      if (cnt[t[j]] > mx.second || (cnt[t[j]] == mx.second && t[j] < mx.first))
        mx = make_pair(t[j], cnt[t[j]]);
      an[mx.first]++;
    }
  }
  for (int i = 1; i < n + 1; i++) cout << an[i] << " \n"[i == n];
}
