#include <bits/stdc++.h>
using namespace std;
void func(void) {
  freopen("input.c", "r", stdin);
  freopen("output.c", "w", stdout);
}
int b[5009], c[5009];
int main() {
  long long n, q, i, j = 0, temp, t, k, ans = 0, sum = 0, cnt = 0, m, fg = 0, x,
                     y, mx = 0, mx1 = 0, mn = 10000000000000000,
                     mn1 = 10000000000000000;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  ;
  for (i = 0; i < n; i++) {
    mx = 0;
    k = 5009;
    memset(b, 0, sizeof(b));
    for (j = i; j < n; j++) {
      b[a[j]]++;
      if (b[a[j]] > mx) {
        mx = b[a[j]];
        k = a[j];
        c[a[j]]++;
      } else if (b[a[j]] == mx and a[j] < k) {
        k = a[j];
        c[k]++;
      } else
        c[k]++;
    }
  }
  for (i = 1; i <= n; i++) {
    cout << c[i] << " ";
  }
  cout << endl;
  return 0;
}
