#include <bits/stdc++.h>
using namespace std;
int n, c[5555], num[5555], ans[5555];
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
    memset(num, 0, sizeof(num));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++) {
      memset(num, 0, sizeof(num));
      num[c[i]]++, ans[c[i]]++;
      int Max = c[i];
      for (int j = i + 1; j <= n; j++) {
        num[c[j]]++;
        if (num[c[j]] > num[Max] || num[c[j]] == num[Max] && c[j] < Max)
          Max = c[j];
        ans[Max]++;
      }
    }
    for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  }
  return 0;
}
