#include <bits/stdc++.h>
using namespace std;
int a[5002], ans[5002], cnt[5002];
int mx, mxi;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof cnt);
    mx = mxi = 0;
    for (int j = i; j <= n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > mx || cnt[a[j]] == mx && a[j] < mxi) {
        mx = cnt[a[j]];
        mxi = a[j];
      }
      ans[mxi]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
