#include <bits/stdc++.h>
using namespace std;
int N, inp[5001], ans[5001], proc[5001], ind, i, j;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> inp[i];
  }
  for (i = 1; i <= N; i++) {
    memset(proc, 0, (N + 1) * sizeof(int));
    ind = 1;
    for (j = i; j <= N; j++) {
      proc[inp[j]]++;
      if (proc[inp[j]] > proc[ind]) {
        ind = inp[j];
      } else if (proc[inp[j]] == proc[ind]) {
        ind = min(ind, inp[j]);
      }
      ans[ind]++;
    }
  }
  for (i = 1; i <= N; i++) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
}
