#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
const int N = 6000;
int a[N], res[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    vector<int> cnt(n + 1, 0), mn(n + 1, n + 1);
    int mx = 0;
    for (int j = i; j < n; ++j) {
      ++cnt[a[j]];
      mx = max(mx, cnt[a[j]]);
      mn[cnt[a[j]]] = min(mn[cnt[a[j]]], a[j]);
      ++res[mn[mx]];
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << res[i] << " ";
  }
  cout << '\n';
}
