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