#include <bits/stdc++.h>
using namespace std;
int a[5005], num[5005], answer[5005];
int main() {
  int n;
  int cnt = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    memset(num, 0, sizeof(num));
    int maxx = 0;
    for (int j = i; j <= n; j++) {
      num[a[j]]++;
      if (num[a[j]] > num[maxx]) {
        maxx = a[j];
      } else if (num[a[j]] == num[maxx] && maxx > a[j]) {
        maxx = a[j];
      }
      answer[maxx]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d%c", answer[i], i == n ? '\n' : ' ');
}
