#include <bits/stdc++.h>
using namespace std;
int n, t[5005], ans[5005], re[5005];
int main() {
  int i, j, k;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> t[i];
  for (i = 1; i <= n; i++) {
    memset(re, 0, sizeof(re));
    re[t[i]]++;
    ans[t[i]]++;
    int ma = t[i];
    for (j = i + 1; j <= n; j++) {
      re[t[j]]++;
      if (re[t[j]] > re[ma] || re[t[j]] == re[ma] && t[j] < ma) ma = t[j];
      ans[ma]++;
    }
  }
  for (i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  getchar();
  getchar();
}
