#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
int A[N], ans[N], cnt[N];
int n, cur;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof(cnt));
    cur = 1;
    for (int k = i; k <= n; k++) {
      cnt[A[k]]++;
      if (cnt[A[k]] > cnt[cur]) cur = A[k];
      if (cnt[A[k]] == cnt[cur] && A[k] < cur) cur = A[k];
      ans[cur]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
