#include <bits/stdc++.h>
using namespace std;
int n;
int t[5050], cnt[5050];
int tmp[5050];
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(t, 0, sizeof(t));
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
    int dominant;
    for (int i = 1; i <= n; i++) {
      memset(tmp, 0, sizeof(tmp));
      dominant = 0;
      for (int j = i; j <= n; j++) {
        tmp[t[j]] += 1;
        if (tmp[dominant] < tmp[t[j]] ||
            (tmp[dominant] == tmp[t[j]] && dominant > t[j]))
          dominant = t[j];
        cnt[dominant]++;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (i != 1) printf(" ");
      printf("%d", cnt[i]);
    }
    puts("");
  }
}
