#include <bits/stdc++.h>
using namespace std;
int n;
int a[5005];
int ans[5005];
int num[5005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int pos;
  int t = 0;
  for (int i = 1; i <= n; i++) {
    memset(num, 0, sizeof(num));
    t = 0;
    for (int j = i; j <= n; j++) {
      num[a[j]]++;
      if ((num[a[j]] == t && a[j] < pos) || num[a[j]] > t) {
        pos = a[j];
        t = num[a[j]];
        ans[pos]++;
      } else {
        ans[pos]++;
      }
    }
  }
  for (int i = 1; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << ans[n] << endl;
}
