#include <bits/stdc++.h>
using namespace std;
struct cmp {
  bool operator()(pair<int, int> a, pair<int, int> b) {
    if (a.first != b.first) return a.first < b.first;
    return a.second > b.second;
  }
};
const int N = 100100;
int cnt[N], vis[N];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n + 1), ans(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  priority_queue<pair<int, int>, vector<pair<int, int> >, cmp> pq;
  for (int i = 1; i <= n; i++) {
    while (!pq.empty()) pq.pop();
    for (int j = i; j <= n; j++) {
      int color = a[j];
      if (vis[color] != i) {
        vis[color] = i;
        cnt[color] = 1;
      } else {
        cnt[color]++;
      }
      pq.push(make_pair(cnt[color], color));
      ans[pq.top().second]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
