#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int arr[5005] = {}, ans[5005] = {}, arr2[5005] = {};
priority_queue<pair<int, int>> pq;
int main() {
  ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> arr[i];
  for (int j = 1; j <= n; ++j) {
    for (int i = j; i <= n; ++i) {
      arr2[arr[i]]++;
      pq.push({arr2[arr[i]], -arr[i]});
      pq.top();
      ans[-pq.top().second]++;
    }
    while (!pq.empty()) pq.pop();
    memset(arr2, 0, sizeof(arr2));
  }
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
  return 0;
}
