#include <bits/stdc++.h>
using namespace std;
const int SIZE = 5e3 + 1;
int a[SIZE];
int t[SIZE];
int main() {
  int n;
  cin >> n;
  int mx = 0;
  for (int i = 0; i < n; i++) scanf("%d", &t[i]);
  for (int i = 0; i < n; i++) {
    int b[SIZE] = {0};
    for (int j = i; j < n; j++) {
      b[t[j]]++;
      if (b[t[j]] > b[mx] || (b[t[j]] == b[mx] && mx > t[j])) mx = t[j];
      a[mx]++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", a[i]);
  return 0;
}
