#include <bits/stdc++.h>
using namespace std;
const int nax = 5005;
int ans[nax];
int a[nax];
int cur[nax];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i], a[i]--;
  for (int i = 0; i < n; ++i) {
    int best = 0;
    for (int j = 0; j < n; ++j) cur[j] = 0;
    for (int j = i; j < n; ++j) {
      cur[a[j]]++;
      if (cur[a[j]] > cur[best] || (cur[a[j]] == cur[best] && a[j] < best))
        best = a[j];
      ans[best]++;
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << ' ';
  return 0;
}
