#include <bits/stdc++.h>
using namespace std;
struct data {
  int gt, sl;
};
data t[100000];
map<int, int> a, ss;
map<int, int>::iterator it;
class compare {
 public:
  bool operator()(data t1, data t2) {
    if (t1.sl > t2.sl) return false;
    if (t1.sl < t2.sl) return true;
    if (t1.gt > t2.gt) return false;
    if (t1.gt < t2.gt) return true;
  }
};
priority_queue<data, vector<data>, compare> pq;
int n, d[100005];
int b[10005];
int main() {
  int nhan, i, j, max1, dem[100000];
  while (scanf("%d", &n) > 0) {
    for (i = 1; i <= n; i++) d[i] = 0;
    a.clear();
    for (i = 0; i < n; i++) {
      scanf("%d", &b[i]);
    }
    for (i = 0; i < n; i++) {
      max1 = 0;
      nhan = 0;
      for (j = 1; j <= n; j++) dem[j] = 0;
      for (j = i; j < n; j++) {
        dem[b[j]]++;
        if (dem[b[j]] > max1) {
          max1 = dem[b[j]];
          nhan = b[j];
        } else {
          if (dem[b[j]] == max1) {
            if (nhan > b[j]) {
              nhan = b[j];
            }
          }
        }
        d[nhan]++;
      }
    }
    for (i = 1; i <= n; i++) {
      if (i == 1)
        printf("%d", d[i]);
      else
        printf(" %d", d[i]);
    }
    printf("\n");
  }
  return 0;
}
