#include <bits/stdc++.h>
using namespace std;
int freq[1000005], arr[1000005], ans[1000005];
int main(void) {
  int n, m, i, j, x, y, k;
  cin >> n;
  k = n + 1;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j <= n; j++) freq[j] = 0;
    int maxTillNow = 0, idx = i;
    for (j = i; j < n; j++) {
      freq[arr[j]]++;
      if (freq[arr[j]] > maxTillNow) {
        maxTillNow = freq[arr[j]];
        idx = j;
      } else if (freq[arr[j]] == maxTillNow) {
        if (arr[j] < arr[idx]) idx = j;
      }
      ans[arr[idx]]++;
    }
  }
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
