#include <bits/stdc++.h>
using namespace std;
int n, a[5005], d[5005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    vector<int> v(n + 10);
    int cur = 0, cnt = 0;
    for (int j = i; j < n; ++j) {
      v[a[j]]++;
      if (cnt < v[a[j]] || (cnt == v[a[j]] && cur > a[j]))
        cur = a[j], cnt = v[a[j]], d[a[j]]++;
      else
        d[cur]++;
    }
  }
  for (int i = 1; i <= n; ++i) cout << d[i] << ' ';
  return 0;
}
