#include <bits/stdc++.h>
using namespace std;
int n, k, i, j, mas[50077], fix[50077], dom, a[50077];
int main() {
  cin >> n;
  for (k = 1; k <= n; k++) cin >> a[k];
  for (k = 1; k <= n; k++) {
    dom = a[k];
    for (j = 1; j <= n; j++) mas[a[j]] = 0;
    for (i = k; i <= n; i++) {
      mas[a[i]]++;
      if (mas[a[i]] > mas[dom])
        dom = a[i];
      else if (a[i] < dom && mas[a[i]] == mas[dom])
        dom = a[i];
      fix[dom]++;
    }
  }
  for (k = 1; k <= n; k++) cout << fix[k] << " ";
}
