#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
mt19937 ggen;
struct node {
  int col, freq;
  node() {}
  node(int col, int freq) : col(col), freq(freq) {}
};
bool operator<(const node &a, const node &b) {
  if (a.freq < b.freq)
    return 1;
  else if (a.freq == b.freq && a.col > b.col)
    return 1;
  else
    return 0;
}
priority_queue<node> q;
int n;
int a[10000];
int u[10000];
int timer;
int ctr[10000];
int ans[10000];
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    timer++;
    while (!q.empty()) q.pop();
    for (int j = i; j < n; j++) {
      if (u[a[j]] != timer) {
        u[a[j]] = timer;
        ctr[a[j]] = 0;
      }
      ctr[a[j]]++;
      q.push(node(a[j], ctr[a[j]]));
      while (ctr[q.top().col] != q.top().freq) q.pop();
      ans[q.top().col]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
}
void testgen(int n) {
  ofstream ofs("input.txt", ios_base::out);
  mt19937 gen(1337);
  ofs << n << '\n';
  uniform_int_distribution<int> distr(1, n);
  for (int i = 0; i < n; i++) ofs << distr(gen) << ' ';
  ofs.close();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  srand(1313);
  ggen = mt19937(13);
  solve();
  return 0;
}
