#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> t(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  vector<int> dominant(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    vector<int> nBallsOfEachColorFromi(n + 1, 0);
    pair<int, int> maxi = make_pair(t[i], 1);
    for (int j = i; j <= n; j++) {
      nBallsOfEachColorFromi[t[j]]++;
      if ((nBallsOfEachColorFromi[t[j]] > maxi.second) ||
          (nBallsOfEachColorFromi[t[j]] == maxi.second && maxi.first > t[j])) {
        maxi = make_pair(t[j], nBallsOfEachColorFromi[t[j]]);
      }
      dominant[maxi.first]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << dominant[i] << " ";
  cout << endl;
  return 0;
}
