#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int siz = 2e5 + 5;
int n, m, a[siz], cur[5010], ans[siz];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    memset(cur, 0, sizeof cur);
    int sofar = a[i];
    cur[sofar]++;
    ans[sofar]++;
    for (int j = i + 1; j <= n; j++) {
      cur[a[j]]++;
      if (cur[a[j]] > cur[sofar] or (cur[a[j]] == cur[sofar] and a[j] < sofar))
        sofar = a[j];
      ans[sofar]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
