#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<long long> t(n);
  for (long long i = 0; i < n; i++) cin >> t[i];
  vector<long long> ans(n, 0);
  for (long long i = 0; i < n; i++) {
    long long mx = 0, num = n + 1;
    vector<long long> a(n + 1, 0);
    for (long long j = i; j < n; j++) {
      a[t[j]]++;
      if (mx <= a[t[j]]) {
        if (mx == a[t[j]]) {
          if (num > t[j]) {
            mx = a[t[j]];
            num = t[j];
          }
        } else {
          mx = a[t[j]];
          num = t[j];
        }
      }
      ans[num - 1]++;
    }
  }
  for (long long i = 0; i < n; i++) printf("%lld ", ans[i]);
  puts("");
}
