#include <bits/stdc++.h>
using namespace std;
const long long MAXX = 1111111;
const int MXN = 1e5 + 1;
int n, a[MXN];
int id[MXN], cnt[MXN], ans[MXN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; --i) {
    id[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; ++j) {
      cnt[a[j]] = 0;
    }
    int mx = 0, id2;
    for (int j = i; j <= n; ++j) {
      cnt[a[j]]++;
      if (cnt[a[j]] > mx) {
        mx = cnt[a[j]];
        id2 = a[j];
      } else if (cnt[a[j]] == mx) {
        if (a[j] < id2) {
          id2 = a[j];
        }
      }
      ans[id2]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << " ";
  }
  return 0;
}
