#include <bits/stdc++.h>
using namespace std;
int n, A[5001], B[5001], S[5001], ma, man;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      S[A[j]]++;
      if (S[A[j]] > ma || (S[A[j]] == ma && A[j] < man)) {
        ma = S[A[j]];
        man = A[j];
      }
      B[man]++;
    }
    ma = 0;
    for (int j = 1; j <= n; j++) S[j] = 0;
  }
  for (int i = 1; i <= n; i++) cout << B[i] << " ";
  return 0;
}
