#include <bits/stdc++.h>
using namespace std;
const int MAX = 5005;
int ans[MAX], a[MAX], cnt[MAX];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &(a[i]));
    ans[a[i]]++;
  }
  for (int i = 0; i < n; ++i) {
    fill(cnt, cnt + n + 1, 0);
    int w = a[i];
    cnt[a[i]]++;
    for (int j = i + 1; j < n; ++j) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[w]) {
        w = a[j];
      } else if (cnt[a[j]] == cnt[w]) {
        w = min(a[j], w);
      }
      ans[w]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}
