#include <bits/stdc++.h>
using namespace std;
long long n, m, i, a[50000], b[50000], sum, sum1, q1, k, kk, j, j2, f, n1, i1,
    y, p, l, mosemka_nikita_umnie_ludi, s, k1, i2, ans[100000],
    mxq = -1, x, mnn = 1e9, mn, mx, o, li, ri, lj, h, rj, d[100], g[100000];
char c, c1;
double q;
int q2, q3, q4, q5;
int main() {
  long long i, mxi, mni;
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  string s, s1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      b[a[j]]++;
      if (b[a[j]] > b[mx] or (b[a[j]] == b[mx] and a[j] < mx)) mx = a[j];
      ans[mx]++;
    }
    for (j = 0; j < n; j++) b[a[j]] = 0;
    mx = 0;
  }
  for (i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
