#include <bits/stdc++.h>
using namespace std;
int ans[5001], cnt[5001];
int main() {
  int i, j, n;
  int t[5000];
  cin >> n;
  for (i = 0; i <= (int)(n)-1; i++) cin >> t[i];
  for (i = 0; i <= (int)(n)-1; i++) {
    for (j = 0; j <= (int)(n + 1) - 1; j++) cnt[j] = 0;
    int index;
    int mx = 0;
    for (j = i; j <= n - 1; j++) {
      cnt[t[j]]++;
      if (cnt[t[j]] > mx || cnt[t[j]] == mx && t[j] < index) {
        mx = cnt[t[j]];
        index = t[j];
      }
      ans[index]++;
    }
  }
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
