#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 3e5 + 10;
const int INF = 1000000000;
const int inf = 1e9 + 1;
const double eps = 1e-9;
int cnt[5005];
int a[5005];
int ans[5005];
int main() {
  int n;
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); ++(i)) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    memset(cnt, 0, sizeof(cnt));
    int cur = -1;
    int val = -1;
    for (int(j) = (i); (j) < (n); ++(j)) {
      cnt[a[j]]++;
      if (cnt[a[j]] > cur || (cur == cnt[a[j]] && val > a[j])) {
        cur = cnt[a[j]];
        val = a[j];
      }
      ans[val]++;
    }
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
