#include <bits/stdc++.h>
using namespace std;
const int MAX = 5555;
int n, t[MAX], all[MAX], ans[MAX];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[i]);
  }
  int mx, pos;
  for (int i = 1; i <= n; i++) {
    memset(all, 0, sizeof(all));
    all[t[i]]++;
    ans[t[i]]++;
    mx = 1;
    pos = t[i];
    for (int j = i + 1; j <= n; j++) {
      all[t[j]]++;
      if (mx < all[t[j]] || (mx == all[t[j]] && pos > t[j])) {
        mx = all[t[j]];
        pos = t[j];
      }
      ans[pos]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) {
      printf(" ");
    }
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
