#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = LLONG_MAX;
const long long ninf = LLONG_MIN;
const long double eps = 1e-12;
const long long N = 1000005;
const long long M = 5005;
const long long LOGN = 19;
long long n;
long long t[N];
long long m[5005];
long long ans[5005];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> t[i];
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < n + 1; k++) m[k] = 0;
    long long cura = -1, curj = inf;
    for (long long j = i; j < n; j++) {
      m[t[j]]++;
      if (cura < m[t[j]]) {
        cura = m[t[j]];
        curj = t[j];
      } else if (cura == m[t[j]]) {
        if (curj > t[j]) {
          curj = t[j];
        }
      }
      ans[curj]++;
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i + 1] << " ";
  cout << "\n";
  return 0;
}
