#include <bits/stdc++.h>
using namespace std;
int count1[100000];
int result[100000];
int main() {
  int n;
  cin >> n;
  int arr[n];
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  count1[0] = 0;
  for (i = 0; i < n; i++) {
    int best = 0;
    memset(count1, 0, sizeof(count1));
    count1[0] = 0;
    for (j = i; j < n; j++) {
      count1[arr[j]]++;
      if (count1[arr[j]] > count1[best]) {
        best = arr[j];
        result[best]++;
      } else if (count1[arr[j]] == count1[best] && arr[j] < best) {
        best = arr[j];
        result[best]++;
      } else {
        result[best]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << result[i] << " ";
  }
  cout << "\n";
  return 0;
}
