#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 5009;
int a[maxn];
int howmany[maxn];
int res[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < maxn; j++) howmany[j] = 0;
    int ma = 0;
    int node = 10000000;
    for (int j = i; j < n; j++) {
      howmany[a[j]]++;
      if (howmany[a[j]] > ma) {
        ma = howmany[a[j]];
        node = a[j];
        res[a[j]]++;
      } else if (howmany[a[j]] == ma) {
        if (a[j] <= node) {
          node = a[j];
          res[a[j]]++;
        } else {
          res[node]++;
        }
      } else {
        res[node]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d ", res[i]);
  }
}
