#include <bits/stdc++.h>
const int INF = 1e+9, MAXN = 5005;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n], ans[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ans[i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    vector<int> cnt(n, 0);
    int best = INF;
    for (int j = i; j < n; ++j) {
      ++cnt[a[j] - 1];
      if (best == INF || cnt[a[j] - 1] > cnt[best] ||
          (cnt[a[j] - 1] == cnt[best] && a[j] - 1 < best)) {
        best = a[j] - 1;
      }
      ++ans[best];
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << ' ';
  }
  cout << '\n';
  return 0;
}
