#include <bits/stdc++.h>
using namespace std;
int a[5002], t[5002], c[5002];
int main() {
  int n, i, j, k, m, col;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> t[i];
    c[i] = 0;
  }
  for (j = 1; j <= n; j++) {
    for (i = 0; i <= n; i++) c[i] = 0;
    col = 0;
    for (i = j; i <= n; i++) {
      c[t[i]]++;
      if (c[col] < c[t[i]])
        col = t[i];
      else if (c[col] == c[t[i]] && t[i] < col)
        col = t[i];
      a[col]++;
    }
  }
  for (i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
