#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, maxs = 0, color = 0;
  cin >> n;
  vector<int> A(n);
  vector<int> answer(n, 0);
  vector<int> cou(n);
  for (i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cou[j] = 0;
    }
    maxs = 0;
    color = 0;
    for (j = i; j < n; j++) {
      cou[A[j] - 1] += 1;
      if (cou[A[j] - 1] > maxs) {
        maxs = cou[A[j] - 1];
        color = A[j] - 1;
      } else if (cou[A[j] - 1] == maxs and color > A[j] - 1) {
        color = A[j] - 1;
      }
      answer[color] += 1;
    }
  }
  for (i = 0; i < n; i++) {
    cout << answer[i] << ' ';
  }
  return 0;
}
