#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long t[5005];
  for (long long i = 1; i <= n; i++) {
    cin >> t[i];
  }
  long long cnt[5005], ans[5005];
  memset(ans, 0, sizeof ans);
  for (long long i = 1; i <= n; i++) {
    memset(cnt, 0, sizeof cnt);
    long long bestColor = 0;
    for (long long j = i; j <= n; j++) {
      long long col = t[j];
      cnt[col]++;
      if (cnt[col] > cnt[bestColor] or
          (cnt[col] == cnt[bestColor] and col < bestColor)) {
        bestColor = col;
      }
      ans[bestColor]++;
    }
  }
  for (long long i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
  return 0;
}
