#include <bits/stdc++.h>
using namespace std;
const int MX = 1000 * 5 + 20;
int cnt[MX], ans[MX];
int n, col[MX];
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> col[i];
  }
  for (int i = 0; i < n; i++) {
    memset(cnt, 0, sizeof(cnt));
    int mx = 0, clr = 0;
    for (int j = i; j < n; j++) {
      cnt[col[j]]++;
      if (cnt[col[j]] > mx) {
        mx = cnt[col[j]];
        clr = col[j];
      } else if (cnt[col[j]] == mx && col[j] < clr)
        clr = col[j];
      ans[clr]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
