#include <bits/stdc++.h>
using namespace std;
const int N = 5 * int(1e3) + 3;
int T[N];
int Ans[N];
int Col[N];
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first > b.first)
    return true;
  else {
    if (a.first == b.first) {
      if (a.second <= b.second)
        return true;
      else
        return false;
    } else {
      return false;
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> T[i];
  }
  for (int j = 0; j < n; ++j) {
    pair<int, int> Best = make_pair(0, 0);
    for (int k = j; k < n; ++k) {
      Col[T[k]]++;
      pair<int, int> Check = make_pair(Col[T[k]], T[k]);
      if (comp(Check, Best)) Best = Check;
      Ans[Best.second]++;
    }
    for (int t = 0; t <= n; ++t) {
      Col[t] = 0;
    }
  }
  for (int u = 1; u <= n; ++u) {
    cout << Ans[u] << " ";
  }
  return 0;
}
