#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e4;
int MG[MAXN], NG[MAXN];
;
int vis_t[5005], MAX, Max, x, y;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &MG[i]);
  for (int i = 1; i <= n; i++) {
    x = MG[i];
    NG[x]++;
    memset(vis_t, 0, sizeof(vis_t));
    vis_t[x]++;
    for (int j = i + 1; j <= n; j++) {
      y = MG[j];
      vis_t[y]++;
      if (vis_t[y] >= vis_t[x] && y != x) {
        if (vis_t[y] > vis_t[x]) {
          NG[y]++;
          x = y;
        } else if (y < x) {
          NG[y]++;
          x = y;
        } else
          NG[x]++;
      } else
        NG[x]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == n)
      printf("%d\n", NG[i]);
    else
      printf("%d ", NG[i]);
  }
}
