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