#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int arr[N], cnt[N], ans[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 1; j <= n; ++j) cnt[j] = 0;
    int mxcnt = 0, mxclr = 0;
    for (int j = i; j < n; ++j) {
      ++cnt[arr[j]];
      if (cnt[arr[j]] > mxcnt) {
        mxcnt = cnt[arr[j]];
        mxclr = arr[j];
      } else if (cnt[arr[j]] == mxcnt)
        mxclr = min(mxclr, arr[j]);
      ans[mxclr]++;
    }
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
