#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b;
  node() {}
  node(int x, int y) {
    a = x;
    b = y;
  }
  bool operator<(const node &no) const {
    return a < no.a || (a == no.a && b > no.b);
  }
};
int p[5001], ret[5001], num[5001];
int main() {
  int n, i, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", p + i);
  for (i = 1; i <= n; i++) {
    priority_queue<node> qe;
    memset(num, 0, sizeof(num));
    for (k = i; k <= n; k++) {
      num[p[k]]++;
      qe.push(node(num[p[k]], p[k]));
      ret[qe.top().b]++;
    }
  }
  for (i = 1; i <= n; i++) {
    if (i > 1) printf(" ");
    printf("%d", ret[i]);
  }
  return 0;
}
