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