#include <bits/stdc++.h>
const int SZ = 5e3 + 5;
using namespace std;
int n, a[SZ];
int cumm[SZ][SZ], res[SZ];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= n; i++) {
    int c[SZ] = {0};
    for (int j = i; j <= n; j++) {
      c[a[j]]++;
      cumm[i][j] = c[a[j]];
    }
  }
  for (int i = 1; i <= n; i++) {
    int curMax = 0, curIdx = SZ;
    int j = 1;
    while (cumm[i][j] == 0) j++;
    for (; j <= n; j++) {
      if (cumm[i][j] > curMax || (cumm[i][j] == curMax && a[j] < curIdx)) {
        curMax = cumm[i][j];
        curIdx = a[j];
      }
      res[curIdx]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << res[i] << ' ';
}
