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