#include <bits/stdc++.h>
using namespace std;
int n, a[1000000 + 100], ans[1000000 + 100], cnt[1000000 + 100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    ans[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cnt[j] = 0;
    }
    int curr = 0;
    for (int j = i; j <= n; j++) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cnt[curr] || (cnt[a[j]] == cnt[curr] && a[j] < curr))
        curr = a[j];
      ans[curr]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
