#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int N = 5e3 + 10;
int n;
int t[N];
int cnt[N];
int res[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (int r = 1; r <= n; r++) {
    memset(cnt, 0, sizeof(cnt));
    int mxCnt = 0, val = -1;
    for (int l = r; l >= 1; l--) {
      cnt[t[l]]++;
      if (cnt[t[l]] > mxCnt || (cnt[t[l]] == mxCnt && t[l] < val)) {
        mxCnt = cnt[t[l]];
        val = t[l];
      }
      res[val]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << res[i] << " ";
  }
  return 0;
}
