#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int a[maxn], num[maxn], cnt[maxn], N;
int main() {
  scanf("%d", &N);
  memset(num, 0, sizeof(num));
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= N; ++i) scanf("%d", &a[i]);
  int mx, xx, id;
  for (int i = 1; i <= N; ++i) {
    id = i;
    for (int j = i; j <= N; ++j) cnt[a[j]] = 0;
    for (int j = i; j <= N; ++j) {
      ++cnt[a[j]];
      if (cnt[a[j]] > cnt[a[id]] || (cnt[a[j]] == cnt[a[id]] && a[id] > a[j]))
        id = j;
      ++num[a[id]];
    }
  }
  for (int i = 1; i <= N - 1; ++i) {
    printf("%d ", num[i]);
  }
  printf("%d\n", num[N]);
  return 0;
}
