#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = 1e9 + 7;
const int nax = 2e5 + 666;
const int L = 25;
const int B = 60;
bool cmp(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int ans[n + 1], a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    vector<int> h(n + 1, 0);
    int mx = 0, ind = 2e9;
    for (int j = i; j <= n; j++) {
      h[a[j]]++;
      if (h[a[j]] > mx) {
        mx = h[a[j]];
        ind = a[j];
      } else if (h[a[j]] == mx && a[j] < ind) {
        ind = a[j];
      }
      ans[ind]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
