#include <bits/stdc++.h>
using namespace std;
int n;
int arr[5050];
int A[5050];
int B[5050];
void cal() {
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    int idx = 0;
    memset(A, 0, sizeof(A));
    for (int j = i; j <= n; j++) {
      A[arr[j]]++;
      int uu = A[arr[j]];
      if (uu > sum) {
        sum = uu;
        idx = arr[j];
      } else if (uu == sum && arr[j] < idx)
        idx = arr[j];
      B[idx]++;
    }
  }
  for (int i = 1; i <= n; i++) cout << B[i] << " ";
  cout << endl;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  cal();
  return 0;
}
