#include <bits/stdc++.h>
using namespace std;
int hashi[5005] = {0};
int ans[5002] = {0};
int a[5002] = {0};
int main() {
  int i, j, t;
  int n;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int st[4040] = {0};
  for (i = 0; i < n; i++) {
    if (st[a[i]] == 0) st[a[i]] = i + 1;
  }
  for (i = 0; i < n; i++) {
    int maxi = 0;
    int ele = 0, elep = 0;
    for (j = i; j < n; j++) {
      hashi[a[j]]++;
      if (hashi[a[j]] == maxi) {
        if (a[j] < ele) {
          ele = a[j];
          ans[a[j]]++;
        } else
          ans[ele]++;
      } else if (hashi[a[j]] > maxi) {
        ele = a[j];
        ans[ele]++;
        maxi = hashi[a[j]];
      } else {
        ans[ele]++;
      }
    }
    memset(hashi, 0, sizeof(hashi));
  }
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}
