#include <bits/stdc++.h>
using namespace std;
int us1[10000];
int us[10000];
int main() {
  long long t, n, l = 0, r = 1e9, sum = 0;
  pair<int, int> ans;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    ans.first = 0;
    ans.second = 10000;
    fill(us, us + n + 10, 0);
    for (int j = i; j < n; j++) {
      us[a[j]]++;
      if (ans.first < us[a[j]]) ans.second = a[j];
      ans.first = max(ans.first, us[a[j]]);
      if (ans.first == us[a[j]]) ans.second = min(a[j], ans.second);
      us1[ans.second]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << us1[i] << " ";
  return 0;
}
