#include <bits/stdc++.h>
using namespace std;
const int sz = 5005;
int ans[sz], arr[sz], pos[sz];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
    if (!pos[arr[i]]) {
      pos[arr[i]] = i;
    }
  }
  for (int i = 1; i <= n; ++i) {
    unordered_map<int, int> cnt;
    cnt.reserve(n - i + 1);
    pair<int, int> mx = {0, 0};
    for (int j = i; j <= n; ++j) {
      ++cnt[arr[j]];
      if (cnt[arr[j]] > mx.first ||
          (cnt[arr[j]] == mx.first && arr[j] < mx.second)) {
        mx.first = cnt[arr[j]];
        mx.second = arr[j];
      }
      ++ans[mx.second];
    }
    cnt.clear();
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
  return 0;
}
