#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return rand(); }
inline int rnd(int x) { return myrand() % x; }
const int inf = (int)1.01e9;
const long double eps = 1e-9;
const long double pi = acos((long double)-1.0);
void precalc() {}
const int maxn = (int)5e3 + 10;
int a[maxn];
int n;
int read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    --a[i];
  }
  return 1;
}
int cnt[maxn], ans[maxn];
void solve() {
  for (int i = 0; i < n; ++i) {
    ans[i] = 0;
  }
  for (int l = 0; l < n; ++l) {
    for (int i = 0; i < n; ++i) {
      cnt[i] = 0;
    }
    pair<int, int> mx(0, 0);
    for (int r = l; r < n; ++r) {
      cnt[a[r]] += 1;
      mx = max(mx, make_pair(cnt[a[r]], -a[r]));
      ans[-mx.second] += 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d%c", ans[i], " \n"[i == n - 1]);
  }
}
int main() {
  srand(rdtsc());
  precalc();
  while (1) {
    if (!read()) {
      break;
    }
    solve();
  }
  return 0;
}
